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 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;
|
const { title, description, image } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -25,7 +32,7 @@ const { title, description, image } = Astro.props;
|
|||||||
rel="alternate"
|
rel="alternate"
|
||||||
type="application/rss+xml"
|
type="application/rss+xml"
|
||||||
title={SITE_TITLE}
|
title={SITE_TITLE}
|
||||||
href={new URL('rss.xml', Astro.site)}
|
href={rssUrl}
|
||||||
/>
|
/>
|
||||||
<meta name="generator" content={Astro.generator} />
|
<meta name="generator" content={Astro.generator} />
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ const { selectedTag } = Astro.props;
|
|||||||
const tags = await getAllTags();
|
const tags = await getAllTags();
|
||||||
|
|
||||||
const posts = await getPublishedPosts( selectedTag );
|
const posts = await getPublishedPosts( selectedTag );
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<RootLayout>
|
<RootLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user