From 55d9d834a5f620e9160b9008e715db1b615d6067 Mon Sep 17 00:00:00 2001 From: Claas Augner <495429+caugner@users.noreply.github.com> Date: Fri, 27 Oct 2023 12:38:36 +0200 Subject: [PATCH] chore(blog): type buildBlog() param type (#9830) * chore(build/blog): add buildBlog() param type * chore(build/blog): avoid render() requiring full doc * fix(build/blog): remove unset modified property --- build/blog.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/build/blog.ts b/build/blog.ts index 708cd599084f..d88e2949c6c8 100644 --- a/build/blog.ts +++ b/build/blog.ts @@ -344,8 +344,18 @@ export async function buildBlogPosts(options: { } } +interface BlogPostDoc { + url: string; + rawBody: string; + metadata: BlogPostMetadata & { locale: string }; + isMarkdown: boolean; + fileInfo: { + path: string; + }; +} + export async function buildPost( - document + document: BlogPostDoc ): Promise<{ doc: Doc; liveSamples: any }> { const { metadata } = document; @@ -358,7 +368,7 @@ export async function buildPost( let $ = null; const liveSamples: LiveSample[] = []; - [$] = await kumascript.render(document.url, {}, document); + [$] = await kumascript.render(document.url, {}, document as any); const liveSamplePages = await kumascript.buildLiveSamplePages( document.url, @@ -402,8 +412,6 @@ export async function buildPost( throw error; } - doc.modified = metadata.modified || null; - doc.pageTitle = `${doc.title} | MDN Blog`; doc.noIndexing = false;