unhead 1.6.1 → 1.7.0
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 +16 -5
- package/dist/index.mjs +16 -5
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -67,6 +67,11 @@ const DedupePlugin = shared.defineHeadPlugin({
|
|
|
67
67
|
newTags.push(...dupes);
|
|
68
68
|
});
|
|
69
69
|
ctx.tags = newTags;
|
|
70
|
+
ctx.tags = ctx.tags.filter((t) => {
|
|
71
|
+
if (t.tag === "meta" && t.props.name && !t.props.content)
|
|
72
|
+
return false;
|
|
73
|
+
return true;
|
|
74
|
+
});
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
77
|
});
|
|
@@ -190,14 +195,20 @@ const TemplateParamsPlugin = shared.defineHeadPlugin({
|
|
|
190
195
|
delete params.separator;
|
|
191
196
|
params.pageTitle = shared.processTemplateParams(params.pageTitle || title || "", params, sep);
|
|
192
197
|
for (const tag of tags) {
|
|
193
|
-
if (
|
|
198
|
+
if (tag.processTemplateParams === false)
|
|
199
|
+
continue;
|
|
200
|
+
if (["titleTemplate", "title"].includes(tag.tag) && typeof tag.textContent === "string") {
|
|
194
201
|
tag.textContent = shared.processTemplateParams(tag.textContent, params, sep);
|
|
195
|
-
else if (tag.tag === "meta" && typeof tag.props.content === "string")
|
|
202
|
+
} else if (tag.tag === "meta" && typeof tag.props.content === "string") {
|
|
196
203
|
tag.props.content = shared.processTemplateParams(tag.props.content, params, sep);
|
|
197
|
-
else if (tag.tag === "link" && typeof tag.props.href === "string")
|
|
204
|
+
} else if (tag.tag === "link" && typeof tag.props.href === "string") {
|
|
198
205
|
tag.props.href = shared.processTemplateParams(tag.props.href, params, sep);
|
|
199
|
-
else if (tag.
|
|
200
|
-
|
|
206
|
+
} else if (tag.processTemplateParams === true) {
|
|
207
|
+
if (tag.innerHTML)
|
|
208
|
+
tag.innerHTML = shared.processTemplateParams(tag.innerHTML, params, sep);
|
|
209
|
+
else if (tag.textContent)
|
|
210
|
+
tag.textContent = shared.processTemplateParams(tag.textContent, params, sep);
|
|
211
|
+
}
|
|
201
212
|
}
|
|
202
213
|
ctx.tags = tags.filter((tag) => tag.tag !== "templateParams");
|
|
203
214
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -66,6 +66,11 @@ const DedupePlugin = defineHeadPlugin({
|
|
|
66
66
|
newTags.push(...dupes);
|
|
67
67
|
});
|
|
68
68
|
ctx.tags = newTags;
|
|
69
|
+
ctx.tags = ctx.tags.filter((t) => {
|
|
70
|
+
if (t.tag === "meta" && t.props.name && !t.props.content)
|
|
71
|
+
return false;
|
|
72
|
+
return true;
|
|
73
|
+
});
|
|
69
74
|
}
|
|
70
75
|
}
|
|
71
76
|
});
|
|
@@ -189,14 +194,20 @@ const TemplateParamsPlugin = defineHeadPlugin({
|
|
|
189
194
|
delete params.separator;
|
|
190
195
|
params.pageTitle = processTemplateParams(params.pageTitle || title || "", params, sep);
|
|
191
196
|
for (const tag of tags) {
|
|
192
|
-
if (
|
|
197
|
+
if (tag.processTemplateParams === false)
|
|
198
|
+
continue;
|
|
199
|
+
if (["titleTemplate", "title"].includes(tag.tag) && typeof tag.textContent === "string") {
|
|
193
200
|
tag.textContent = processTemplateParams(tag.textContent, params, sep);
|
|
194
|
-
else if (tag.tag === "meta" && typeof tag.props.content === "string")
|
|
201
|
+
} else if (tag.tag === "meta" && typeof tag.props.content === "string") {
|
|
195
202
|
tag.props.content = processTemplateParams(tag.props.content, params, sep);
|
|
196
|
-
else if (tag.tag === "link" && typeof tag.props.href === "string")
|
|
203
|
+
} else if (tag.tag === "link" && typeof tag.props.href === "string") {
|
|
197
204
|
tag.props.href = processTemplateParams(tag.props.href, params, sep);
|
|
198
|
-
else if (tag.
|
|
199
|
-
|
|
205
|
+
} else if (tag.processTemplateParams === true) {
|
|
206
|
+
if (tag.innerHTML)
|
|
207
|
+
tag.innerHTML = processTemplateParams(tag.innerHTML, params, sep);
|
|
208
|
+
else if (tag.textContent)
|
|
209
|
+
tag.textContent = processTemplateParams(tag.textContent, params, sep);
|
|
210
|
+
}
|
|
200
211
|
}
|
|
201
212
|
ctx.tags = tags.filter((tag) => tag.tag !== "templateParams");
|
|
202
213
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unhead",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.7.0",
|
|
5
5
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"hookable": "^5.5.3",
|
|
33
|
-
"@unhead/
|
|
34
|
-
"@unhead/
|
|
35
|
-
"@unhead/shared": "1.
|
|
33
|
+
"@unhead/dom": "1.7.0",
|
|
34
|
+
"@unhead/schema": "1.7.0",
|
|
35
|
+
"@unhead/shared": "1.7.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "unbuild .",
|