From ef4fab2cb69ebd902785b2c9d158bcf82c278d72 Mon Sep 17 00:00:00 2001 From: libr Date: Mon, 19 Jan 2026 18:12:13 +0800 Subject: [PATCH] fix: tag not found --- src/pages/tags/[...id].astro | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/pages/tags/[...id].astro b/src/pages/tags/[...id].astro index 4e22f09..8ddfee7 100644 --- a/src/pages/tags/[...id].astro +++ b/src/pages/tags/[...id].astro @@ -3,27 +3,11 @@ import BlogCard from '@/components/BlogCard.astro' import Breadcrumbs from '@/components/Breadcrumbs.astro' import PageHead from '@/components/PageHead.astro' import Layout from '@/layouts/Layout.astro' -import { getAllTags, getPostsByTag } from '@/lib/data-utils' +import { getPostsByTag } from '@/lib/data-utils' -export async function getStaticPaths() { - const tagMap = await getAllTags() - const uniqueTags = Array.from(tagMap.keys()) - - return Promise.all( - uniqueTags.map(async (tag) => { - const posts = await getPostsByTag(tag) - return { - params: { id: tag }, - props: { - tag, - posts, - }, - } - }), - ) -} - -const { tag, posts } = Astro.props +// params.id is the tag name (string for [...id] rest parameter) +const tag = Astro.params.id ?? '' +const posts = await getPostsByTag(tag) export const prerender = false ---