fix: blog images#28
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Blog thumbnail on the deployed
/blogpage 404s becauseuseBlogImages.getOgImageUrlcallsgetOgImagePath(whichnuxt-og-imagev6 marks@deprecated) without the defaults merge and_queryinjection thatdefineOgImageapplies before hashing, so producer and consumer compute differentsimpleHash(JSON.stringify(options))values. The listing's<img src>and the post'sBlogPostingJSON-LD both point at/_og/s/o_h61es8.png.