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 ); + ---