From 0e4c43886956b8e0ee35fc6c4b62270bae5d02d8 Mon Sep 17 00:00:00 2001 From: Drew Haven Date: Mon, 16 Mar 2026 11:35:49 -0700 Subject: [PATCH] Adds per-tag RSS link to each tag page. --- src/components/BaseHead.astro | 9 ++++++++- src/layouts/BlogList.astro | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 0005296..36e5e56 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -13,6 +13,13 @@ interface Props { const canonicalURL = new URL(Astro.url.pathname, Astro.site); +const blogTagMatch = Astro.url.pathname.match(/blog\/tag\/(\w+)/); + +const rssUrl = + blogTagMatch + ? new URL(`blog/tag/${blogTagMatch[1]}.rss.xml`, Astro.site) + : new URL(`rss.xml`, Astro.site); + const { title, description, image } = Astro.props; --- @@ -25,7 +32,7 @@ const { title, description, image } = Astro.props; rel="alternate" type="application/rss+xml" title={SITE_TITLE} - href={new URL('rss.xml', Astro.site)} + href={rssUrl} /> diff --git a/src/layouts/BlogList.astro b/src/layouts/BlogList.astro index 4f46b3f..a0d967b 100644 --- a/src/layouts/BlogList.astro +++ b/src/layouts/BlogList.astro @@ -14,6 +14,7 @@ const { selectedTag } = Astro.props; const tags = await getAllTags(); const posts = await getPublishedPosts( selectedTag ); + ---