made ogimage generation concurrent

This commit is contained in:
松浦 知也 Matsuura Tomoya 2025-10-29 20:56:55 -04:00
parent 08c861707b
commit feb5a5c74d

View File

@ -114,11 +114,13 @@ export const CustomOgImages: QuartzEmitterPlugin<Partial<SocialImageOptions>> =
const headerFont = cfg.theme.typography.header
const bodyFont = cfg.theme.typography.body
const fonts = await getSatoriFonts(headerFont, bodyFont)
for (const [_tree, vfile] of content) {
if (vfile.data.frontmatter?.socialImage !== undefined) continue
yield processOgImage(ctx, vfile.data, fonts, fullOptions)
Promise.all(
content.map(([_tree, vfile]) => {
if (vfile.data.frontmatter?.socialImage !== undefined) {
processOgImage(ctx, vfile.data, fonts, fullOptions)
}
}),
)
},
async *partialEmit(ctx, _content, _resources, changeEvents) {
const cfg = ctx.cfg.configuration