Skip to content

Add content hashes to UI stylesheet and script URLs - #215

Merged
glebfox merged 1 commit into
release_3from
feature/ui-asset-hash
Oct 12, 2026
Merged

glebfox merged 1 commit into
release_3from
feature/ui-asset-hash

Conversation

@glebfox

@glebfox glebfox commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

The site loads its stylesheets and scripts from fixed URLs such as _/css/site.css. The IntelliJ IDEA built-in browser keeps the copies it cached, so after a release it shows new pages with old styles until the user runs Invalidate Caches.

Now each UI stylesheet and script URL carries a hash of the file content, for example _/css/site.css?v=2eca4c9a57. A changed file gets a new URL, and the browser loads it.

  • ui/asset-hash-extension.js is an Antora extension. It hashes every CSS and JS file of the UI (ours, the bundle's and the Lunr extension's) and registers the asset Handlebars helper.
  • head-styles.hbs and footer-scripts.hbs reference the files as {{{asset 'css/site.css'}}} instead of {{{uiRootPath}}}/css/site.css. The helper fails the build when the UI has no such file.
  • Both playbooks register the extension after the Lunr extension. A playbook without the extension fails with Missing helper: "asset", so a production playbook kept outside this repository needs the same line.
  • ui/README.md and AGENTS.md describe the helper.

search-index.js is not a UI file and stays without a hash. The hashes work only when the browser requests fresh HTML, so the server should send the pages with Cache-Control: no-cache.

Checked: the site builds, all 13 hashes in the HTML match the published files, and node tools/ui-audit.mjs passes.

@glebfox
glebfox merged commit fc14200 into release_3 Oct 12, 2026
1 check passed
@glebfox
glebfox deleted the feature/ui-asset-hash branch October 12, 2026 13:41
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