Skip to content

Commit

Permalink
fix: Tags page not being created
Browse files Browse the repository at this point in the history
Tags page expected every page to have a `tags` attribute in the
frontmatter, this requirement is now waived
  • Loading branch information
rjkilpatrick committed Sep 7, 2023
1 parent 6005caf commit 406b3a5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pages/tags/[tag].astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ export async function getStaticPaths() {
const uniqueTags = makeUnique(
// Get flattened list of all tags in the posts
posts.map((post) => post.frontmatter.tags).flat()
posts
.map((post) => post.frontmatter.tags)
.flat()
.filter((tag) => tag) // Remove undefined values
);
return uniqueTags.map((tag) => {
const filteredPosts = posts.filter((post) =>
post.frontmatter.tags.includes(tag)
post.frontmatter.tags?.includes(tag)
);
return {
params: { tag },
Expand Down

0 comments on commit 406b3a5

Please sign in to comment.