unhead 2.0.3 → 2.0.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/plugins.mjs +5 -4
- package/package.json +1 -1
package/dist/plugins.mjs
CHANGED
|
@@ -71,19 +71,20 @@ function InferSeoMetaPlugin(options = {}) {
|
|
|
71
71
|
key: "infer-seo-meta",
|
|
72
72
|
hooks: {
|
|
73
73
|
"tags:beforeResolve": ({ tagMap }) => {
|
|
74
|
-
let title = head.
|
|
75
|
-
const titleTemplate = head._titleTemplate;
|
|
74
|
+
let title = head._titleTemplate || head._title;
|
|
76
75
|
const ogTitle = tagMap.get("meta:og:title");
|
|
77
76
|
if (typeof ogTitle?.props["data-infer"] !== "undefined") {
|
|
78
|
-
if (
|
|
79
|
-
title =
|
|
77
|
+
if (typeof title === "function") {
|
|
78
|
+
title = title(head._title);
|
|
80
79
|
}
|
|
81
80
|
ogTitle.props.content = options.ogTitle ? options.ogTitle(title) : title || "";
|
|
81
|
+
ogTitle.processTemplateParams = true;
|
|
82
82
|
}
|
|
83
83
|
const description = tagMap.get("meta:description")?.props?.content;
|
|
84
84
|
const ogDescription = tagMap.get("meta:og:description");
|
|
85
85
|
if (typeof ogDescription?.props["data-infer"] !== "undefined") {
|
|
86
86
|
ogDescription.props.content = options.ogDescription ? options.ogDescription(description) : description || "";
|
|
87
|
+
ogDescription.processTemplateParams = true;
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
}
|