From 927c7ddd5097aa684fd15e369ecf48b5f8fab482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20P=C4=99dzich?= Date: Tue, 2 May 2023 08:25:57 +0200 Subject: [PATCH] Split page title with a pipe if title's not home --- src/components/BaseHead.astro | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 88db36b..eb39945 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -2,6 +2,7 @@ // Import the global.css file here so that it is included on // all pages through the use of the component. import '../styles/global.css'; +import { SITE_TITLE } from '../consts'; export interface Props { title: string; @@ -9,9 +10,10 @@ export interface Props { image?: string; } -const canonicalURL = new URL(Astro.url.pathname, Astro.site); - const { title, description, image = '/placeholder-social.jpg' } = Astro.props; + +const canonicalURL = new URL(Astro.url.pathname, Astro.site); +const actualTitle = title === 'home' ? SITE_TITLE : title + ' | ' + SITE_TITLE; --- @@ -19,16 +21,16 @@ const { title, description, image = '/placeholder-social.jpg' } = Astro.props; -{title} - +{actualTitle} + - + - +