@decocms/start 2.1.2 → 2.1.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/package.json +1 -1
- package/src/routes/cmsRoute.ts +14 -0
package/package.json
CHANGED
package/src/routes/cmsRoute.ts
CHANGED
|
@@ -390,6 +390,20 @@ async function buildPageSeo(
|
|
|
390
390
|
if (siteSeo.title && !merged.title) merged.title = siteSeo.title;
|
|
391
391
|
if (siteSeo.description && !merged.description) merged.description = siteSeo.description;
|
|
392
392
|
if (siteSeo.image && !merged.image) merged.image = siteSeo.image;
|
|
393
|
+
|
|
394
|
+
// Apply site-level templates even when there is no page-level seo
|
|
395
|
+
// section. Without this, pages whose title comes from a content
|
|
396
|
+
// section (e.g. <h1> + sectionSeo) or from the site default would
|
|
397
|
+
// skip `siteSeo.titleTemplate`, causing prod-vs-worker title drift.
|
|
398
|
+
const titleTemplate = effectiveTemplate(siteSeo.titleTemplate);
|
|
399
|
+
const descTemplate = effectiveTemplate(siteSeo.descriptionTemplate);
|
|
400
|
+
if (titleTemplate && merged.title) {
|
|
401
|
+
merged.title = titleTemplate.replace("%s", merged.title);
|
|
402
|
+
}
|
|
403
|
+
if (descTemplate && merged.description) {
|
|
404
|
+
merged.description = descTemplate.replace("%s", merged.description);
|
|
405
|
+
}
|
|
406
|
+
|
|
393
407
|
return merged;
|
|
394
408
|
}
|
|
395
409
|
|