From 15646d81e0a34eeafe6637c6b703ed0d7663303e Mon Sep 17 00:00:00 2001 From: szsascha <> Date: Wed, 17 Aug 2022 19:34:00 +0200 Subject: [PATCH] feat(theme): extend titleTemplate by replacing the title change createTitle to be able to use the title within thetitleTemplate --- src/shared/shared.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/shared/shared.ts b/src/shared/shared.ts index 71c167cabce3..2bb1637db847 100644 --- a/src/shared/shared.ts +++ b/src/shared/shared.ts @@ -104,6 +104,11 @@ export function resolveSiteDataByRoute( export function createTitle(siteData: SiteData, pageData: PageData): string { const title = pageData.title || siteData.title const template = pageData.titleTemplate ?? siteData.titleTemplate + + if (typeof template === 'string' && template.includes(':title')) { + return template.replace(/:title/g, title) + } + const templateString = createTitleTemplate(siteData.title, template) return `${title}${templateString}`