fix: exclude draft posts in specific tag page

This commit is contained in:
satnaing
2023-01-29 20:08:01 +06:30
parent e8171d327e
commit c192cd8e50
+4 -8
View File
@@ -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);
---