Adds per-tag RSS link to each tag page.
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ const { selectedTag } = Astro.props;
|
||||
const tags = await getAllTags();
|
||||
|
||||
const posts = await getPublishedPosts( selectedTag );
|
||||
|
||||
---
|
||||
|
||||
<RootLayout>
|
||||
|
||||
Reference in New Issue
Block a user