From cdd06635aff1fd9e46fc390657459cecaa476a09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Latzarus?= Date: Fri, 17 Jan 2025 23:02:46 +0100 Subject: [PATCH] feat: append site title to page title --- src/layouts/Base.astro | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index 0b2f3ba..d3efb4a 100755 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -38,6 +38,9 @@ export interface Props { // distructure frontmatters const { title, meta_title, description, image, noindex, canonical } = Astro.props; + +const titleFromProps = plainify(meta_title ? meta_title : title ? title : ''); +const pageTitle = titleFromProps ? `${titleFromProps} ยท ${config.site.title}` : config.site.title; --- @@ -100,7 +103,7 @@ const { title, meta_title, description, image, noindex, canonical } = - {plainify(meta_title ? meta_title : title ? title : config.site.title)} + {pageTitle}