From 48b5be61f8bdf896e7e3e5e01d3919a7d4b2e892 Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 27 Nov 2023 21:23:10 -0600 Subject: [PATCH] Minimal tags page implementation, remove coments from feed.xml.ts --- src/pages/feed.xml.ts | 3 --- src/pages/tags/[...slug].astro | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/pages/tags/[...slug].astro diff --git a/src/pages/feed.xml.ts b/src/pages/feed.xml.ts index 5c9b7b4..f5b8016 100644 --- a/src/pages/feed.xml.ts +++ b/src/pages/feed.xml.ts @@ -15,9 +15,6 @@ export async function GET(context) { description: post.data.description, pubDate: post.data.pubDate, categories: post.data.tags, - // Generate a `url` from each post `slug` - // This assumes all blog posts are rendered as `/blog/[slug]` routes - // https://docs.astro.build/en/guides/content-collections/#generating-pages-from-content-collections link: `/posts/${post.slug}/`, })), }); diff --git a/src/pages/tags/[...slug].astro b/src/pages/tags/[...slug].astro new file mode 100644 index 0000000..c8eaecb --- /dev/null +++ b/src/pages/tags/[...slug].astro @@ -0,0 +1,15 @@ +--- +import General from '@layouts/General.astro'; +import { getCollection } from 'astro:content'; + +export async function getStaticPaths() { + const blogEntries = await getCollection('blog'); + const tags = new Set(blogEntries.map(entry => entry.data.tags).flat()); + return Array.from(tags, (tag) => ({ params: {slug: tag}, props: {tag}})); +} + +const { tag } = Astro.props; +--- + + { tag } + \ No newline at end of file