Skip to content

Commit

Permalink
fix: exclude draft posts in specific tag page
Browse files Browse the repository at this point in the history
  • Loading branch information
satnaing committed Jan 29, 2023
1 parent e8171d3 commit c192cd8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/pages/tags/[tag].astro
Original file line number Diff line number Diff line change
Expand Up @@ -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);
---
Expand Down

0 comments on commit c192cd8

Please sign in to comment.