unhead 1.0.2 → 1.0.3
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 +2 -1
- package/dist/index.mjs +2 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -264,7 +264,7 @@ const renderTitleTemplate = (template, title) => {
|
|
|
264
264
|
return template.replace("%s", title ?? "");
|
|
265
265
|
};
|
|
266
266
|
function resolveTitleTemplateFromTags(tags) {
|
|
267
|
-
|
|
267
|
+
let titleTemplateIdx = tags.findIndex((i) => i.tag === "titleTemplate");
|
|
268
268
|
const titleIdx = tags.findIndex((i) => i.tag === "title");
|
|
269
269
|
if (titleIdx !== -1 && titleTemplateIdx !== -1) {
|
|
270
270
|
const newTitle = renderTitleTemplate(
|
|
@@ -283,6 +283,7 @@ function resolveTitleTemplateFromTags(tags) {
|
|
|
283
283
|
if (newTitle !== null) {
|
|
284
284
|
tags[titleTemplateIdx].children = newTitle;
|
|
285
285
|
tags[titleTemplateIdx].tag = "title";
|
|
286
|
+
titleTemplateIdx = -1;
|
|
286
287
|
}
|
|
287
288
|
}
|
|
288
289
|
if (titleTemplateIdx !== -1) {
|
package/dist/index.mjs
CHANGED
|
@@ -262,7 +262,7 @@ const renderTitleTemplate = (template, title) => {
|
|
|
262
262
|
return template.replace("%s", title ?? "");
|
|
263
263
|
};
|
|
264
264
|
function resolveTitleTemplateFromTags(tags) {
|
|
265
|
-
|
|
265
|
+
let titleTemplateIdx = tags.findIndex((i) => i.tag === "titleTemplate");
|
|
266
266
|
const titleIdx = tags.findIndex((i) => i.tag === "title");
|
|
267
267
|
if (titleIdx !== -1 && titleTemplateIdx !== -1) {
|
|
268
268
|
const newTitle = renderTitleTemplate(
|
|
@@ -281,6 +281,7 @@ function resolveTitleTemplateFromTags(tags) {
|
|
|
281
281
|
if (newTitle !== null) {
|
|
282
282
|
tags[titleTemplateIdx].children = newTitle;
|
|
283
283
|
tags[titleTemplateIdx].tag = "title";
|
|
284
|
+
titleTemplateIdx = -1;
|
|
284
285
|
}
|
|
285
286
|
}
|
|
286
287
|
if (titleTemplateIdx !== -1) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unhead",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
5
|
-
"packageManager": "pnpm@7.
|
|
4
|
+
"version": "1.0.3",
|
|
5
|
+
"packageManager": "pnpm@7.17.0",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"
|
|
34
|
-
"@unhead/
|
|
35
|
-
"
|
|
33
|
+
"hookable": "^5.4.2",
|
|
34
|
+
"@unhead/dom": "1.0.3",
|
|
35
|
+
"@unhead/schema": "1.0.3"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"zhead": "^1.0.
|
|
38
|
+
"zhead": "^1.0.4"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "unbuild .",
|