From fef2a6a62d0cc0c0f521993b416a788ed40e1520 Mon Sep 17 00:00:00 2001 From: Esteban Date: Fri, 8 May 2026 08:52:54 -0500 Subject: [PATCH] feat: add BaseHead component and dynamic news article page template with SEO metadata --- src/components/BaseHead.astro | 31 +++++++++++++++++------ src/pages/[locale]/[news_slug]/[id].astro | 2 +- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 016ad67..debc779 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -1,7 +1,7 @@ --- import { ClientRouter } from "astro:transitions"; -import { GoogleAnalytics } from 'astro-google-analytics'; +import { GoogleAnalytics } from "astro-google-analytics"; const { title = "Centro del Reino de Paz y Justicia", description = "", @@ -11,6 +11,7 @@ const { } = Astro.props; const imageUrl = image ? new URL(image, Astro.site).toString() : null; +const canonicalURL = new URL(url || Astro.url.pathname, Astro.site); --- @@ -19,24 +20,39 @@ const imageUrl = image ? new URL(image, Astro.site).toString() : null; - + {title} - + {url && } + {imageUrl && } - - + + - {date && } + { + date && ( + + ) + } @@ -45,6 +61,5 @@ const imageUrl = image ? new URL(image, Astro.site).toString() : null; {imageUrl && } {url && } - - \ No newline at end of file + diff --git a/src/pages/[locale]/[news_slug]/[id].astro b/src/pages/[locale]/[news_slug]/[id].astro index 383dd78..5b190a1 100644 --- a/src/pages/[locale]/[news_slug]/[id].astro +++ b/src/pages/[locale]/[news_slug]/[id].astro @@ -67,7 +67,7 @@ const dateISO = `${y}-${m}-${d}`; title={post.data.title} description={excerpt} image={post.data.thumbnail} - url={canonicalUrl} + url={canonicalUrl.toString()} date={post.data.date} >