Skip to content

fix: blog images#28

Merged
Kumzy merged 3 commits into
mainfrom
blog-image
May 28, 2026
Merged

fix: blog images#28
Kumzy merged 3 commits into
mainfrom
blog-image

Conversation

@Kumzy

@Kumzy Kumzy commented May 28, 2026

Copy link
Copy Markdown
Member

Blog thumbnail on the deployed /blog page 404s because useBlogImages.getOgImageUrl calls getOgImagePath (which nuxt-og-image v6 marks @deprecated) without the defaults merge and _query injection that defineOgImage applies before hashing, so producer and consumer compute different simpleHash(JSON.stringify(options)) values. The listing's <img src> and the post's BlogPosting JSON-LD both point at /_og/s/o_h61es8.png.

Kumzy added 3 commits May 28, 2026 15:26
Walks dist/**/*.html for <img>/JSON-LD references to static OG hash URLs
and asserts each file exists. Permanent guardrail against consumer-side
hash predictions drifting from what defineOgImage actually emits.

Currently red on /blog and /blog/<slug>: both reference o_h61es8.png,
which is never written. Goes green once the producer/consumer drift in
useBlogImages is fixed in the following commits.
useBlogImages.getOgImageUrl was calling getOgImagePath (@deprecated)
without the defaults merge and _query injection that _defineOgImageRaw
applies before hashing, so simpleHash(JSON.stringify(options)) produced
a different value than the producer. The listing thumbnail and the
post's BlogPosting JSON-LD both ended up pointing at /_og/s/o_h61es8.png,
a file the prerender never wrote.

Both consumers now go through defineOgImage itself — the documented
public entry point that the deprecation on getOgImagePath redirects to.
The listing calls defineOgImage('Blog', articles.map(...)) with distinct
key values per article (so each call is its own payload entry instead
of overwriting the 'Page' card) and stashes the returned URL array in
useState for hydration stability. The post page captures paths[0] from
its existing defineOgImage call and feeds it to defineArticle.

useBlogImages collapses to a single path-agnostic merge helper:
caller-supplied OG paths are the fallback when frontmatter image: is
absent. The composable no longer touches the og-image module at all,
removing the class of bug entirely.

Closes litestar-4rg.1, litestar-4rg.2, litestar-4rg.3.
toStaticOgPath fixed a /_og/d/ → /_og/s/ prefix mismatch that only the
direct getOgImagePath() call could hit. With the listing and post page
now going through defineOgImage (which joins the correct prefix itself
via _defineOgImageRaw / client-utils), nothing in app/ calls it.

Closes litestar-4rg.4.
@Kumzy
Kumzy merged commit a3ed4e2 into main May 28, 2026
2 checks passed
@Kumzy
Kumzy deleted the blog-image branch May 28, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant