diff --git a/build/blog.ts b/build/blog.ts index dcbac287bc70..ea62c87362bc 100644 --- a/build/blog.ts +++ b/build/blog.ts @@ -75,6 +75,9 @@ export async function findPostLiveSampleBySlug( rawBody: body, metadata: { locale: DEFAULT_LOCALE, ...blogMeta }, isMarkdown: true, + fileInfo: { + path: file, + }, }); return liveSamples.find((page) => page.id.toLowerCase() === id)?.html; } @@ -94,6 +97,9 @@ export async function findPostBySlug( rawBody: body, metadata: { locale: DEFAULT_LOCALE, ...blogMeta }, isMarkdown: true, + fileInfo: { + path: file, + }, }); return { doc, blogMeta }; } @@ -177,6 +183,9 @@ export async function buildBlogPosts(options: { rawBody: body, metadata: { locale, ...blogMeta }, isMarkdown: true, + fileInfo: { + path: file, + }, }; const { doc: builtDoc, liveSamples } = await buildPost(renderDoc); const { doc } = { diff --git a/kumascript/index.ts b/kumascript/index.ts index f10c7e52b5db..d00c3ea07e0c 100644 --- a/kumascript/index.ts +++ b/kumascript/index.ts @@ -91,6 +91,7 @@ export async function render( rawHTML, { ...metadata, + path: fileInfo?.path, url, tags: metadata.tags || [], selective_mode, diff --git a/kumascript/src/templates.ts b/kumascript/src/templates.ts index 30169b343391..1cd129e64047 100644 --- a/kumascript/src/templates.ts +++ b/kumascript/src/templates.ts @@ -108,7 +108,12 @@ export default class Templates { }); return rendered.trim(); } catch (error) { - console.error(`${name} macro failed:`, error); + console.error( + `The ${name} macro in ${ + args.env.path ?? args.env.url + } failed to render.`, + error + ); throw error; } }