From ef2b3e1daeda90b37a545b9cc4f18c28e44ed49d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20P=C4=99dzich?= Date: Wed, 10 May 2023 22:44:00 +0200 Subject: [PATCH] Convert BaseHead component to BaseLayout --- src/components/BaseHead.astro | 36 --------- src/layouts/BaseLayout.astro | 57 ++++++++++++++ src/layouts/BlogPost.astro | 42 ++++------ src/pages/index.astro | 139 +++++++++++++++------------------- 4 files changed, 136 insertions(+), 138 deletions(-) delete mode 100644 src/components/BaseHead.astro create mode 100644 src/layouts/BaseLayout.astro diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro deleted file mode 100644 index eb39945..0000000 --- a/src/components/BaseHead.astro +++ /dev/null @@ -1,36 +0,0 @@ ---- -// 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; - description: string; - image?: string; -} - -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; ---- - - - - - - -{actualTitle} - - - - - - - - - - - - diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro new file mode 100644 index 0000000..c8ea10a --- /dev/null +++ b/src/layouts/BaseLayout.astro @@ -0,0 +1,57 @@ +--- +// 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; + description: string; + image?: string; +} + +import Header from '../components/Header.astro'; +import Footer from '../components/Footer.astro'; + +export interface Props { + title: string; + description: string; + image?: string; +} + +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}`; +--- + + + + + + + + + + {actualTitle} + + + + + + + + + + + + + + +
+
+ +
+