hugo-universal-theme icon indicating copy to clipboard operation
hugo-universal-theme copied to clipboard

Fix CSS cache-busting that prevented browser caching

Open vittorio88 opened this issue 8 months ago • 0 comments

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

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

vittorio88 avatar Mar 15 '26 05:03 vittorio88