From f1b6661d6e8d6ae82cecd5d5d50319883d5c04b8 Mon Sep 17 00:00:00 2001 From: Ayo Date: Sun, 5 Mar 2023 19:13:20 +0100 Subject: [PATCH] refactor: hoist script only if title is defined --- src/components/Head.astro | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/Head.astro b/src/components/Head.astro index b472168..a1236b1 100644 --- a/src/components/Head.astro +++ b/src/components/Head.astro @@ -8,16 +8,13 @@ const defaultDescription = const defaultTitle = "Ayo Ayco | Software Engineer, Web Developer, Consultant"; -let { - title = "Ayo Ayco | Software Engineer, Web Developer, Consultant", - description = defaultDescription, -} = Astro.props; +let { title, description = defaultDescription } = Astro.props; const baseURL = "https://ayo.ayco.io"; --- - {title ? title + ` | ${defaultTitle}` : defaultTitle} + {title || defaultTitle} @@ -43,4 +40,17 @@ const baseURL = "https://ayo.ayco.io"; + + { + title ? ( + + ) : ( + + ) + }