@unhead/addons 1.5.5 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -6
- package/dist/index.mjs +6 -6
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -22,13 +22,13 @@ function InferSeoMetaPlugin(options = {}) {
|
|
|
22
22
|
titleTemplate = shared.resolveTitleTemplate(titleTemplate, input.title);
|
|
23
23
|
const title = input.title;
|
|
24
24
|
const description = resolvedMeta.find((meta) => meta.name === "description")?.content;
|
|
25
|
-
const hasOgTitle =
|
|
26
|
-
const hasOgImage =
|
|
27
|
-
const hasTwitterCard =
|
|
28
|
-
const hasOgDescription =
|
|
25
|
+
const hasOgTitle = resolvedMeta.some((meta) => meta.property === "og:title");
|
|
26
|
+
const hasOgImage = resolvedMeta.some((meta) => meta.property === "og:image");
|
|
27
|
+
const hasTwitterCard = resolvedMeta.some((meta) => meta.name === "twitter:card");
|
|
28
|
+
const hasOgDescription = resolvedMeta.some((meta) => meta.property === "og:description");
|
|
29
29
|
entry[inputKey].meta = input.meta || [];
|
|
30
|
-
if (
|
|
31
|
-
let newOgTitle = options?.ogTitle || titleTemplate;
|
|
30
|
+
if (!hasOgTitle && (input.titleTemplate || input.title)) {
|
|
31
|
+
let newOgTitle = options?.ogTitle || titleTemplate || input.title;
|
|
32
32
|
if (typeof newOgTitle === "function")
|
|
33
33
|
newOgTitle = newOgTitle(title);
|
|
34
34
|
if (newOgTitle) {
|
package/dist/index.mjs
CHANGED
|
@@ -20,13 +20,13 @@ function InferSeoMetaPlugin(options = {}) {
|
|
|
20
20
|
titleTemplate = resolveTitleTemplate(titleTemplate, input.title);
|
|
21
21
|
const title = input.title;
|
|
22
22
|
const description = resolvedMeta.find((meta) => meta.name === "description")?.content;
|
|
23
|
-
const hasOgTitle =
|
|
24
|
-
const hasOgImage =
|
|
25
|
-
const hasTwitterCard =
|
|
26
|
-
const hasOgDescription =
|
|
23
|
+
const hasOgTitle = resolvedMeta.some((meta) => meta.property === "og:title");
|
|
24
|
+
const hasOgImage = resolvedMeta.some((meta) => meta.property === "og:image");
|
|
25
|
+
const hasTwitterCard = resolvedMeta.some((meta) => meta.name === "twitter:card");
|
|
26
|
+
const hasOgDescription = resolvedMeta.some((meta) => meta.property === "og:description");
|
|
27
27
|
entry[inputKey].meta = input.meta || [];
|
|
28
|
-
if (
|
|
29
|
-
let newOgTitle = options?.ogTitle || titleTemplate;
|
|
28
|
+
if (!hasOgTitle && (input.titleTemplate || input.title)) {
|
|
29
|
+
let newOgTitle = options?.ogTitle || titleTemplate || input.title;
|
|
30
30
|
if (typeof newOgTitle === "function")
|
|
31
31
|
newOgTitle = newOgTitle(title);
|
|
32
32
|
if (newOgTitle) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/addons",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"ufo": "^1.3.0",
|
|
56
56
|
"unplugin": "^1.4.0",
|
|
57
57
|
"unplugin-ast": "^0.8.2",
|
|
58
|
-
"@unhead/schema": "1.
|
|
59
|
-
"@unhead/shared": "1.
|
|
58
|
+
"@unhead/schema": "1.6.1",
|
|
59
|
+
"@unhead/shared": "1.6.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@babel/types": "^7.22.17",
|