Skip to content

Commit dadf2c6

Browse files
committed
fix: build per-page OG images cleanly under strict prerender
- Disable Nuxt payload extraction: nuxt-og-image's isInternalRoute only skips paths starting with "/_", so under baseURL "/2026" it processes the "/2026/.../_payload.json" routes as real pages. defineOgImage on session detail pages then made the renderer return no response (500) for those payload routes during prerender. - Drop the prerender failOnError override now that payload routes build cleanly, restoring strict deploy-time error checking for the static build. - Pass defineOgImage props via a variable: under the repo's strict vueCompilerOptions, the inline object literal tripped TS2353 excess-property checks because nuxt-og-image's ReactiveComponentProps resolves to {}.
1 parent 3689e87 commit dadf2c6

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

app/pages/[...slug].vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ useSeoMeta({
3535
twitterDescription: () => page.value?.description,
3636
})
3737
38-
defineOgImage('Default', {
38+
const ogImageProps = {
3939
title: page.value?.title || 'COSCUP 2026 x UbuCon Asia',
4040
subtitle: page.value?.description || '',
41-
})
41+
}
42+
defineOgImage('Default', ogImageProps)
4243
</script>
4344

4445
<template>

app/pages/session/[id].vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ useSeoMeta({
5252
twitterDescription: () => sessionInfo.value?.description,
5353
})
5454
55-
// Data is awaited via useFetch, so sessionInfo is populated at prerender time.
56-
defineOgImage('Session', {
55+
const ogImageProps = {
5756
title: sessionInfo.value?.title ?? '',
5857
speakers: sessionInfo.value?.speakers.map((speaker) => speaker.name).join(', ') ?? '',
5958
room: sessionInfo.value?.room ?? '',
6059
time: sessionInfo.value?.time ?? '',
61-
})
60+
}
61+
defineOgImage('Session', ogImageProps)
6262
6363
function close() {
6464
router.push(localePath('/session'))

nuxt.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,17 @@ export default defineNuxtConfig({
9595
publicDir: process.env.NUXT_OUTPUT_DIR || '.output/public',
9696
},
9797
prerender: {
98-
failOnError: false,
9998
concurrency: 4,
10099
},
101100
},
102101

102+
experimental: {
103+
// nuxt-og-image breaks payload-route rendering on pages that call defineOgImage
104+
// under baseURL "/2026" (its isInternalRoute misses "/2026/.../_payload.json"),
105+
// making the renderer return no response (500). Disable payload extraction.
106+
payloadExtraction: false,
107+
},
108+
103109
imports: {
104110
scan: false,
105111
},

0 commit comments

Comments
 (0)