hugo-universal-theme
hugo-universal-theme copied to clipboard
Fix CSS cache-busting that prevented browser caching
Summary
- Remove
?{{ now.Unix }}timestamp query string fromcustom.csslink - 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.cssbetween 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
hugotwice and confirmcustom.cssURL is stable (no changing query string) - [x] Verify stylesheet still loads correctly in browser