Skip to content

Fingerprint /assets/images URLs in rendered content - #160

Merged
vpetersson merged 1 commit into
sbomify:masterfrom
vpetersson-bot:fix/fingerprint-content-images
Oct 23, 2026
Merged

vpetersson merged 1 commit into
sbomify:masterfrom
vpetersson-bot:fix/fingerprint-content-images

Conversation

@vpetersson-bot

Copy link
Copy Markdown
Contributor

What

Images referenced from content as /assets/images/... are now served from fingerprinted URLs.

Why

After #159 merged, the Zero to Hero diagram on the homepage still showed the old purple palette. The SVG that was deployed was correct (last-modified 19:33 UTC, navy and orange). But content links it as /assets/images/d2/zero-to-hero.svg, an unversioned URL served with cache-control: max-age=14400. Browsers and the CDN therefore kept serving the previous file for up to four hours. Fetching the same URL with a cache-busting query string returned the new diagram.

How

layouts/partials/content.html, which every layout already uses to render page content, now pipes the rendered HTML through layouts/partials/fingerprint-assets.html. That partial finds each src="/assets/images/<path>", looks the file up with resources.Get, and swaps in the fingerprinted RelPermalink, for example /images/d2/zero-to-hero.c35360a6….svg. Any later change to a diagram or image therefore gets a new URL. A file that isn't found under assets/ is left as written.

Verification

  • hugo --minify --environment production builds cleanly.
  • The homepage now references /images/d2/zero-to-hero.<sha256>.svg.
  • Every rewritten src in the built site resolves to a published file (checked all index.html files).
  • bun run lint:markdown passes.

🤖 Generated with Claude Code

After the brand reskin merged, the Zero to Hero diagram on the homepage
still showed the old purple palette. The deployed SVG was correct, but
content referenced it as /assets/images/d2/zero-to-hero.svg, an
unversioned URL served with cache-control max-age=14400, so browsers and
the CDN kept the previous file for up to four hours.

content.html now passes rendered content through
fingerprint-assets.html, which rewrites src="/assets/images/..." to the
fingerprinted copy of the same asset. Any future change to a diagram or
image gets a new URL. Files not found under assets/ are left as
written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
@vpetersson
vpetersson merged commit 1922424 into sbomify:master Oct 23, 2026
2 checks passed
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.

2 participants