unhead 1.1.2 → 1.1.4

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
@@ -281,7 +281,7 @@ const DedupesTagsPlugin = (options) => {
281
281
  function processTemplateParams(s, config) {
282
282
  const replacer = (preserveToken) => (_, token) => {
283
283
  if (token === "pageTitle" || token === "s")
284
- return "%s";
284
+ return config.pageTitle;
285
285
  let val;
286
286
  if (token.includes("."))
287
287
  val = token.split(".").reduce((acc, key) => acc[key] || {}, config);
@@ -304,9 +304,11 @@ function TemplateParamsPlugin() {
304
304
  hooks: {
305
305
  "tags:resolve": (ctx) => {
306
306
  const { tags } = ctx;
307
+ const title = tags.find((tag) => tag.tag === "title")?.textContent;
307
308
  const templateParamsIdx = tags.findIndex((tag) => tag.tag === "templateParams");
308
309
  if (templateParamsIdx !== -1) {
309
310
  const templateParams = tags[templateParamsIdx].textContent;
311
+ templateParams.pageTitle = templateParams.pageTitle || title || "";
310
312
  delete tags[templateParamsIdx];
311
313
  for (const tag of tags) {
312
314
  if (tag) {
@@ -738,11 +740,11 @@ const CorePlugins = () => [
738
740
  // dedupe needs to come first
739
741
  DedupesTagsPlugin(),
740
742
  SortTagsPlugin(),
743
+ TemplateParamsPlugin(),
741
744
  TitleTemplatePlugin(),
742
745
  ProvideTagHashPlugin(),
743
746
  EventHandlersPlugin(),
744
- DeprecatedTagAttrPlugin(),
745
- TemplateParamsPlugin()
747
+ DeprecatedTagAttrPlugin()
746
748
  ];
747
749
  const DOMPlugins = (options = {}) => [
748
750
  dom.PatchDomOnEntryUpdatesPlugin({ document: options?.document, delayFn: options?.domDelayFn })
package/dist/index.mjs CHANGED
@@ -280,7 +280,7 @@ const DedupesTagsPlugin = (options) => {
280
280
  function processTemplateParams(s, config) {
281
281
  const replacer = (preserveToken) => (_, token) => {
282
282
  if (token === "pageTitle" || token === "s")
283
- return "%s";
283
+ return config.pageTitle;
284
284
  let val;
285
285
  if (token.includes("."))
286
286
  val = token.split(".").reduce((acc, key) => acc[key] || {}, config);
@@ -303,9 +303,11 @@ function TemplateParamsPlugin() {
303
303
  hooks: {
304
304
  "tags:resolve": (ctx) => {
305
305
  const { tags } = ctx;
306
+ const title = tags.find((tag) => tag.tag === "title")?.textContent;
306
307
  const templateParamsIdx = tags.findIndex((tag) => tag.tag === "templateParams");
307
308
  if (templateParamsIdx !== -1) {
308
309
  const templateParams = tags[templateParamsIdx].textContent;
310
+ templateParams.pageTitle = templateParams.pageTitle || title || "";
309
311
  delete tags[templateParamsIdx];
310
312
  for (const tag of tags) {
311
313
  if (tag) {
@@ -737,11 +739,11 @@ const CorePlugins = () => [
737
739
  // dedupe needs to come first
738
740
  DedupesTagsPlugin(),
739
741
  SortTagsPlugin(),
742
+ TemplateParamsPlugin(),
740
743
  TitleTemplatePlugin(),
741
744
  ProvideTagHashPlugin(),
742
745
  EventHandlersPlugin(),
743
- DeprecatedTagAttrPlugin(),
744
- TemplateParamsPlugin()
746
+ DeprecatedTagAttrPlugin()
745
747
  ];
746
748
  const DOMPlugins = (options = {}) => [
747
749
  PatchDomOnEntryUpdatesPlugin({ document: options?.document, delayFn: options?.domDelayFn })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unhead",
3
3
  "type": "module",
4
- "version": "1.1.2",
4
+ "version": "1.1.4",
5
5
  "packageManager": "pnpm@7.27.1",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
@@ -32,9 +32,9 @@
32
32
  "dependencies": {
33
33
  "hookable": "^5.4.2",
34
34
  "packrup": "^0.1.0",
35
- "@unhead/dom": "1.1.2",
36
- "@unhead/schema": "1.1.2",
37
- "@unhead/shared": "1.1.2"
35
+ "@unhead/dom": "1.1.4",
36
+ "@unhead/schema": "1.1.4",
37
+ "@unhead/shared": "1.1.4"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "unbuild .",