deleting tag pages for now
This commit is contained in:
parent
a20dc1ee0b
commit
9c5adaaa55
1 changed files with 0 additions and 39 deletions
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue