From 5adb9eb2be4a06d9e3dd208f28a79003082bddba Mon Sep 17 00:00:00 2001 From: Leo McArdle Date: Thu, 5 Sep 2024 12:53:28 +0100 Subject: [PATCH] fix(contributor-spotlight): some old pages not building (#11679) as soon as we hit the featured contributor we were bailing https://mozilla-hub.atlassian.net/browse/MP-1448 --- build/spas.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/build/spas.ts b/build/spas.ts index a10df35d3537..70218b1f75c2 100644 --- a/build/spas.ts +++ b/build/spas.ts @@ -62,6 +62,7 @@ async function buildContributorSpotlight( ) { const prefix = "community/spotlight"; const profileImg = "profile-image.jpg"; + let featuredContributorFrontmatter: DocFrontmatter; for (const contributor of fs.readdirSync(contributorSpotlightRoot)) { const file = `${contributorSpotlightRoot}/${contributor}/index.md`; @@ -118,14 +119,19 @@ async function buildContributorSpotlight( if (options.verbose) { console.log("Wrote", jsonFilePath); } + if (frontMatter.attributes.is_featured) { - return { - contributorName: frontMatter.attributes.contributor_name, - url: `/${locale}/${prefix}/${frontMatter.attributes.folder_name}`, - quote: frontMatter.attributes.quote, - }; + featuredContributorFrontmatter = frontMatter.attributes; } } + + return featuredContributorFrontmatter + ? { + contributorName: featuredContributorFrontmatter.contributor_name, + url: `/${locale}/${prefix}/${featuredContributorFrontmatter.folder_name}`, + quote: featuredContributorFrontmatter.quote, + } + : undefined; } export async function buildSPAs(options: {