unhead 1.6.1 → 1.6.2

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 CHANGED
@@ -190,14 +190,20 @@ const TemplateParamsPlugin = shared.defineHeadPlugin({
190
190
  delete params.separator;
191
191
  params.pageTitle = shared.processTemplateParams(params.pageTitle || title || "", params, sep);
192
192
  for (const tag of tags) {
193
- if (["titleTemplate", "title"].includes(tag.tag) && typeof tag.textContent === "string")
193
+ if (tag.processTemplateParams === false)
194
+ continue;
195
+ if (["titleTemplate", "title"].includes(tag.tag) && typeof tag.textContent === "string") {
194
196
  tag.textContent = shared.processTemplateParams(tag.textContent, params, sep);
195
- else if (tag.tag === "meta" && typeof tag.props.content === "string")
197
+ } else if (tag.tag === "meta" && typeof tag.props.content === "string") {
196
198
  tag.props.content = shared.processTemplateParams(tag.props.content, params, sep);
197
- else if (tag.tag === "link" && typeof tag.props.href === "string")
199
+ } else if (tag.tag === "link" && typeof tag.props.href === "string") {
198
200
  tag.props.href = shared.processTemplateParams(tag.props.href, params, sep);
199
- else if (tag.tag === "script" && ["application/json", "application/ld+json"].includes(tag.props.type) && tag.innerHTML && tag.props.id !== "unhead:payload")
200
- tag.innerHTML = shared.processTemplateParams(tag.innerHTML, params, sep);
201
+ } else if (tag.processTemplateParams === true) {
202
+ if (tag.innerHTML)
203
+ tag.innerHTML = shared.processTemplateParams(tag.innerHTML, params, sep);
204
+ else if (tag.textContent)
205
+ tag.textContent = shared.processTemplateParams(tag.textContent, params, sep);
206
+ }
201
207
  }
202
208
  ctx.tags = tags.filter((tag) => tag.tag !== "templateParams");
203
209
  }
package/dist/index.mjs CHANGED
@@ -189,14 +189,20 @@ const TemplateParamsPlugin = defineHeadPlugin({
189
189
  delete params.separator;
190
190
  params.pageTitle = processTemplateParams(params.pageTitle || title || "", params, sep);
191
191
  for (const tag of tags) {
192
- if (["titleTemplate", "title"].includes(tag.tag) && typeof tag.textContent === "string")
192
+ if (tag.processTemplateParams === false)
193
+ continue;
194
+ if (["titleTemplate", "title"].includes(tag.tag) && typeof tag.textContent === "string") {
193
195
  tag.textContent = processTemplateParams(tag.textContent, params, sep);
194
- else if (tag.tag === "meta" && typeof tag.props.content === "string")
196
+ } else if (tag.tag === "meta" && typeof tag.props.content === "string") {
195
197
  tag.props.content = processTemplateParams(tag.props.content, params, sep);
196
- else if (tag.tag === "link" && typeof tag.props.href === "string")
198
+ } else if (tag.tag === "link" && typeof tag.props.href === "string") {
197
199
  tag.props.href = processTemplateParams(tag.props.href, params, sep);
198
- else if (tag.tag === "script" && ["application/json", "application/ld+json"].includes(tag.props.type) && tag.innerHTML && tag.props.id !== "unhead:payload")
199
- tag.innerHTML = processTemplateParams(tag.innerHTML, params, sep);
200
+ } else if (tag.processTemplateParams === true) {
201
+ if (tag.innerHTML)
202
+ tag.innerHTML = processTemplateParams(tag.innerHTML, params, sep);
203
+ else if (tag.textContent)
204
+ tag.textContent = processTemplateParams(tag.textContent, params, sep);
205
+ }
200
206
  }
201
207
  ctx.tags = tags.filter((tag) => tag.tag !== "templateParams");
202
208
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unhead",
3
3
  "type": "module",
4
- "version": "1.6.1",
4
+ "version": "1.6.2",
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/schema": "1.6.1",
34
- "@unhead/dom": "1.6.1",
35
- "@unhead/shared": "1.6.1"
33
+ "@unhead/dom": "1.6.2",
34
+ "@unhead/schema": "1.6.2",
35
+ "@unhead/shared": "1.6.2"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "unbuild .",