Skip to content

Speed up navigation: no redirects, CDN cache, lazy search index - #499

Merged
scharrier merged 4 commits into
mainfrom
speed-up-navigation
Sep 28, 2026
Merged

scharrier merged 4 commits into
mainfrom
speed-up-navigation

Conversation

@scharrier

Copy link
Copy Markdown
Member

Clicking an internal link on docs.bump.sh took about 800 ms. Three causes, fixed here:

  • Internal links without a trailing slash hit a 301 from Netlify on every click. An inspector adds the slash at build time.
  • Every response was private, max-age=0, so Cloudflare bypassed its cache and browsers revalidated each asset on each visit. Pages are now public and revalidated, fingerprinted assets are immutable for a year. The dead bin/netlify.sh post-build script and its broken preload header go away.
  • The search element fetched a 400 KB index and rebuilt it on every Turbo visit, blocking the main thread for ~180 ms after each navigation. The index now loads on the first focus and is kept for the session. A follow-up will replace the engine with Pagefind.

Netlify serves pages at /path/ and answers /path with a 301, so every
internal link without a slash cost a second round trip on click. An
inspector normalizes them in the built HTML; the navbar data follows.
Every response was private, max-age=0, so Cloudflare bypassed its cache
and browsers revalidated each asset on every visit. Pages stay
revalidated on each request; the fingerprinted bundles and fonts under
/docs/_bridgetown/static are immutable.
The script filled CSS_PATH and JS_PATH placeholders from asset paths
that no longer exist, leaving an empty Link preload header on the home.
The stylesheet and the font are already preloaded from the page head.
The results element fetched the 400 KB index and built the lunr index
every time it connected, that is on every Turbo visit, blocking the main
thread right after each navigation. The index now loads on the first
focus and is shared by both search fields for the whole session.
@netlify

netlify Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for bump-content-hub ready!

Name Link
🔨 Latest commit 0c780c7
🔍 Latest deploy log https://app.netlify.com/projects/bump-content-hub/deploys/6aba8461a054cc00081d2c74
😎 Deploy Preview https://deploy-preview-499--bump-content-hub.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@scharrier

Copy link
Copy Markdown
Member Author

@grossyoan : we'll only see the real cache improvement in production, the previous URL doesn't go through our *.bump.sh domain (= no Cloudflare cache).

@grossyoan

Copy link
Copy Markdown
Contributor

@grossyoan : we'll only see the real cache improvement in production, the previous URL doesn't go through our *.bump.sh domain (= no Cloudflare cache).

Noted!

Nav, search, etc still work, that's what I tried 🙏

@fbraure fbraure left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, that's nice optimizations here ! Thanks 🙏🏻

@scharrier
scharrier merged commit f1c0f48 into main Sep 28, 2026
5 checks passed
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.

3 participants