@@ -12,28 +12,28 @@ export const useBlogImages = () => {
1212 }
1313
1414 // Otherwise, use the auto-generated OG image
15- return getOgImageUrl ( article . path )
15+ return getOgImageUrl ( article )
1616 }
1717
1818 /**
19- * Get the generated OG image URL for a blog post path
19+ * Get the generated OG image URL for a blog post.
20+ *
21+ * v6 encodes the render options into the static file path, so this must use
22+ * the same component + props that blog/[slug].vue passes to defineOgImage()
23+ * ('Blog' with minimal { title, category }). getOgImagePath() is auto-imported
24+ * by nuxt-og-image and joins the app baseURL for us.
2025 */
21- const getOgImageUrl = ( path : string ) : string => {
22- const config = useRuntimeConfig ( )
23- const siteConfig = useSiteConfig ( )
26+ const getOgImageUrl = ( article : BlogArticle ) : string => {
27+ const { path } = getOgImagePath ( article . path , {
28+ component : 'Blog' ,
29+ props : { blog : { title : article . title , category : article . category } } ,
30+ } )
2431
25- // Get the base URL from site config or construct it
26- const baseUrl = siteConfig . url || 'http://localhost:3000'
27-
28- // Get the app base URL (e.g., '/litestar.dev-v2/')
29- const appBase = config . app . baseURL || '/'
30-
31- // Construct the full URL
32- // Remove trailing slash from baseUrl and leading slash from appBase if needed
33- const cleanBaseUrl = baseUrl . replace ( / \/ $ / , '' )
34- const cleanAppBase = appBase === '/' ? '' : appBase . replace ( / \/ $ / , '' )
35-
36- return `${ cleanBaseUrl } ${ cleanAppBase } /__og-image__/static${ path } /og.png`
32+ // Returns the baseURL-prefixed path. These are rendered with @nuxt/image's
33+ // `none` provider (see blog/index.vue) so the URL is used as-is rather than
34+ // run through IPX — the OG image is generated during prerender, so IPX has
35+ // no source file to optimize when the listing page is built first.
36+ return path
3737 }
3838
3939 /**
@@ -51,7 +51,7 @@ export const useBlogImages = () => {
5151 }
5252
5353 // Use generated OG image as primary choice
54- return getOgImageUrl ( article . path )
54+ return getOgImageUrl ( article )
5555 }
5656
5757 /**
0 commit comments