Skip to content

Conversation

@zaclohrenz
Copy link

@zaclohrenz zaclohrenz commented Jan 21, 2026

What does this PR change? What problem does it solve?

Adds timestamp query parameter to index.json fetch request in fastsearch.js to force fresh index retrieval.

When fastsearch.js is cached by the browser (common on CDN-hosted sites), it continues fetching index.json without cache-busting parameters. This causes search to return stale results even after deploying new content, because the browser serves both the cached JS file and the cached index.json it references, even if index.json (freshly queried in the browser by the user) contains updated content from the CDN.

The fix appends ?v=${Date.now()} to the index.json URL, ensuring each page load fetches current search data regardless of whether fastsearch.js itself is cached.

Was the change discussed in an issue or in the Discussions before?

No prior issue filed. Discovered during production deployment where new posts were invisible in search results for non-incognito browsers while index.json contained correct data.

PR Checklist

  • This change adds/updates translations and I have used the template present here.
  • I have enabled maintainer edits for this PR.
  • I have verified that the code works as described/as intended.
  • This change adds a Social Icon which has a permissive license to use it.
  • This change does not include any CDN resources/links.
  • This change does not include any unrelated scripts such as bash and python scripts.
  • This change updates the overridden internal templates from HUGO's repository.

@sonarqubecloud
Copy link

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