Repository navigation
Option to skip generating fallback pages for untranslated content #4419
IEvangelist
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What version of
starlightare you using?0.41.3
What is your idea?
Add a config option that lets sites opt out of prerendering a full fallback copy of every
untranslated page for every locale. For example:
With
'none',getStaticPaths()in Starlight's route builder (utils/routing/index.ts,getPaths())would skip routes where
isFallbackistrue. Everything else stays the same: translated pages,the sidebar, the language picker, and links to locale URLs. The site's host (or Astro's own i18n
fallbackType: 'rewrite'in on-demand mode) is then responsible for answering/de/some-page/with the default-locale content.
Why is this feature necessary?
Today each untranslated page is rendered once per locale. That cost grows with
pages × locales, even when almost nothing is translated.
On aspire.dev (14 locales, ~650 docs pages, but only one locale with meaningful translations), the
fallback copies are ~9,000 HTML files and ~3 GB of the 9.8 GB build output. They are almost
byte-for-byte identical to the English page except for
<html lang>, translated UI strings, and the"This content is not available in your language yet" notice. That inflates:
Sites that serve from a host they control (a server, edge function, or CDN rewrite rule) can
return the default-locale page in place for a missing locale URL. They don't need the copies on disk.
Do you have examples of this feature in other projects?
i18n.fallback+routing.fallbackType: 'rewrite' | 'redirect'.Participation
We currently ship this as a local
bun patchofgetPaths()(dev keeps the existing behavior):function getPaths(): Path[] { - return routes.map((route) => ({ + const pageRoutes = import.meta.env.DEV ? routes : routes.filter((route) => !route.isFallback); + return pageRoutes.map((route) => ({A real implementation would need a config schema entry, docs, and decisions on dev-server behavior,
sitemap/hreflang alternates for omitted URLs, and Pagefind.
All reactions