Skip to content

Fix CSS cache-busting that prevented browser caching#457

Open
vittorio88 wants to merge 1 commit intodevcows:masterfrom
lagobello:fix/css-cache-busting
Open

Fix CSS cache-busting that prevented browser caching#457
vittorio88 wants to merge 1 commit intodevcows:masterfrom
lagobello:fix/css-cache-busting

Conversation

@vittorio88
Copy link
Contributor

@vittorio88 vittorio88 commented Mar 15, 2026

Summary

  • Remove ?{{ now.Unix }} timestamp query string from custom.css link
  • The timestamp generated a unique URL on every Hugo build, which prevented browsers from ever caching the stylesheet
  • After this fix, browsers will properly cache custom.css between visits

Details

Hugo regenerates templates on every build, so now.Unix produced a new value each time. This defeated browser caching entirely for the custom stylesheet, causing unnecessary re-downloads on every page load.

Test plan

  • Run hugo twice and confirm custom.css URL is stable (no changing query string)
  • Verify stylesheet still loads correctly in browser

Remove timestamp query string from custom.css link. The ?{{ now.Unix }}
generated a unique URL on every build, preventing browsers from caching
the stylesheet.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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