From 406b3a5d4c3c959cf4ae00592dd5097a66655da7 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 7 Sep 2023 22:41:12 +0100 Subject: [PATCH] fix: Tags page not being created Tags page expected every page to have a `tags` attribute in the frontmatter, this requirement is now waived --- src/pages/tags/[tag].astro | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/tags/[tag].astro b/src/pages/tags/[tag].astro index 30e6148..2c8e13e 100644 --- a/src/pages/tags/[tag].astro +++ b/src/pages/tags/[tag].astro @@ -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 },