I have a hugo site that I build locally and push to netlify with cli.
I noticed that when I change permalinks, netlify does not seem to refresh the site unless I clear browser cache.
- Build locally
rm -rf public && npx netlify build
- Push to netlify
npx netlify deploy -p
- Verify in netlify admin that the latest push has been published
- Navigate to the site and notice permalinks that where changed still use the old permalinks
- Open Chrome inspector with “disable cache” checked and refresh the page and links on that page are now using the new permalinks
Example:
Old permalinks: x-nf-request-id: e74d8cff-6c64-4da6-aff3-4062127baa28-10495006
New permalinks (after cache flush): x-nf-request-id: 7a6028bc-45af-4739-b681-f82e392fdab8-17522745
Example2:
Old permalinks: x-nf-request-id: 3e01daad-6e33-45d0-80cb-bb238265fbb0-13629186
New permalinks (after cache flush): x-nf-request-id: c7875543-11f1-4c29-bab8-c8eb5c9401a4-14094790
Changing page content (like a paragraph) does not seem to have the same issue. I only have an issue when changing URLs. Global elements, such as the main menu have the incorrect permalinks on every page unless I clear all browser cache for the domain or for each individual page.
I should note that the sitemap file is updating the permalinks correctly and locally all permalinks update fine. This caching issue only happens on netlify.
I’ve also checked the issue on other devices where I haven’t gone to the site in a few days and they too have the issue with incorrect permalinks still being used.
Why is it that regular page content is updating without any issue, but permalinks won’t update without cache purges?