From 50c33099078f4b937c1deee4575ebdfc91da7152 Mon Sep 17 00:00:00 2001 From: Sat Naing Date: Mon, 12 Sep 2022 22:41:30 +0630 Subject: [PATCH] Improve SEO by adding necessary meta tags --- src/layouts/Layout.astro | 45 ++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 2a26bc3..5e7317d 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -2,10 +2,21 @@ import "../styles/base.css"; export interface Props { - title: string; + title?: string; + author?: string; + description?: string; + ogImage?: string; } -const { title } = Astro.props; +const { + title = import.meta.env.PUBLIC_SITE_TITLE, + author = import.meta.env.PUBLIC_AUTHOR, + description = import.meta.env.PUBLIC_SITE_DESC, + ogImage = import.meta.env.PUBLIC_OG_IMAGE, +} = Astro.props; + +const canonicalURL = new URL(Astro.url.pathname, Astro.site); +const socialImageURL = new URL(ogImage, Astro.url); --- @@ -14,19 +25,27 @@ const { title } = Astro.props; + - {title} - - - - - - - - - - + + {title} + + + + + + + + + + + + + + + +