mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
fix: exclude draft posts in specific tag page
This commit is contained in:
@@ -16,25 +16,21 @@ export interface Props {
|
||||
}
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const posts: CollectionEntry<"blog">[] = await getCollection("blog");
|
||||
const posts = await getCollection("blog");
|
||||
|
||||
const tags = getUniqueTags(posts);
|
||||
|
||||
return tags.map(tag => {
|
||||
return {
|
||||
params: {
|
||||
tag,
|
||||
},
|
||||
props: {
|
||||
tag,
|
||||
},
|
||||
params: { tag },
|
||||
props: { tag },
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const { tag } = Astro.props;
|
||||
|
||||
const posts: CollectionEntry<"blog">[] = await getCollection("blog");
|
||||
const posts = await getCollection("blog", ({ data }) => !data.draft);
|
||||
|
||||
const tagPosts = getPostsByTag(posts, tag);
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user