deleting tag pages for now

This commit is contained in:
Laker Turner 2025-03-22 09:00:00 +00:00
parent a20dc1ee0b
commit 9c5adaaa55
No known key found for this signature in database

View file

@ -1,39 +0,0 @@
---
import Layout from "~/layouts/Page.astro";
import { getCollection } from "astro:content";
export async function getStaticPaths() {
const allPosts = await getCollection("blog");
const tags = [...new Set(allPosts.map((post) => post.data.tags).flat())];
return tags.map((tag) => ({
params: { id: tag },
props: { tag },
}));
}
const allPosts = await getCollection("blog");
const { tag } = Astro.props;
const filteredPosts = allPosts.filter(
(post) => post.data.tags && post.data.tags.includes(tag as string)
);
---
<Layout
title={`Posts tagged with "${tag}"`}
description={`A collection of posts tagged with "${tag}"`}
>
<ul class="fa-ul">
{
filteredPosts.length > 0 ? (
filteredPosts.map((post) => (
<li>
<i class="fa-li fa-solid fa-file-alt" />
<a href={`/blog/${post.id}`}>{post.data.title}</a>
</li>
))
) : (
<li>No posts found for this tag.</li>
)
}
</ul>
</Layout>