diff --git a/build/spas.ts b/build/spas.ts index 1afb175a51a5..2e0ff0f1a3d5 100644 --- a/build/spas.ts +++ b/build/spas.ts @@ -75,7 +75,7 @@ async function buildContributorSpotlight( }; const context = { hyData }; - const html = renderHTML(`/${locale}/${prefix}/${contributor}`, context); + const html = renderPage(`/${locale}/${prefix}/${contributor}`, context); const outPath = path.join( BUILD_OUT_ROOT, locale.toLowerCase(), @@ -113,6 +113,10 @@ export async function buildSPAs(options: { // The URL isn't very important as long as it triggers the right route in the const url = `/${DEFAULT_LOCALE}/404.html`; const html = renderHTML(url, { pageNotFound: true }); + html.replace( + '', + "" + ); const outPath = path.join( BUILD_OUT_ROOT, DEFAULT_LOCALE.toLowerCase(), @@ -185,7 +189,7 @@ export async function buildSPAs(options: { noIndexing, }; - const html = renderHTML(url, context); + const html = renderPage(url, context); const outPath = path.join(BUILD_OUT_ROOT, pathLocale, prefix); fs.mkdirSync(outPath, { recursive: true }); const filePath = path.join(outPath, "index.html"); @@ -242,7 +246,7 @@ export async function buildSPAs(options: { pageTitle: `${frontMatter.attributes.title || ""} | ${title}`, }; - const html = renderHTML(url, context); + const html = renderPage(url, context); const outPath = path.join( BUILD_OUT_ROOT, locale, @@ -342,7 +346,7 @@ export async function buildSPAs(options: { featuredArticles, }; const context = { hyData }; - const html = renderHTML(url, context); + const html = renderPage(url, context); const outPath = path.join(BUILD_OUT_ROOT, localeLC); fs.mkdirSync(outPath, { recursive: true }); const filePath = path.join(outPath, "index.html"); @@ -368,6 +372,15 @@ export async function buildSPAs(options: { } } +function renderPage(url: string, context: any) { + const html = renderHTML(url, context); + html.replace( + '', + `` + ); + return html; +} + async function fetchGitHubPRs(repo, count = 5) { const twoDaysAgo = new Date(Date.now() - 48 * 60 * 60 * 1000); const pullRequestsQuery = [