Turn prerendering back on - #49
Merged
Merged
Conversation
✅ Deploy Preview for device-database-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
pierosavi
marked this pull request as ready for review
September 30, 2026 11:19
pierosavi
requested review from
PhilipTrauner
and
a balanced review from Copilot
September 30, 2026 11:19
PhilipTrauner
approved these changes
Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes OHF-Device-Database/backlog-items#169.
PR #39 switched the whole site to server rendering because prerendering broke translations: at build time there is no request URL to read the locale from, so every prerendered page came out in English. This PR prerenders the four content pages again, one static file per locale, and keeps everything else server-rendered.
What is prerendered now
/about,/how-it-works,/editorial-stance,/imprint(+/de/...,/fr/..., all 31 locales)/,/browse,/devices/[id]/surveys?survey=/404,/robots.txt,/config.jsHow it works
src/pages/[...locale]/. The optional[...locale]segment is the language prefix./aboutis English (no prefix),/de/aboutis German. Prerendered pages list their locales viagetStaticPaths(localeStaticPathsinsrc/utilities/locale.ts), so the build writes one HTML file per locale.Sec-Fetch-Dest, so at build time we pass a barenew Request(context.url)instead./en/about,/foo/about,/de/nonexistentrender the localized 404 page.NOINDEXorCSR_API_AUTHORITYfrom the container's env. Two consequences:/config.jsendpoint instead of being inlined into the HTML.src/io/index.tsreads it per call instead of at module load.robotsmeta tag orX-Robots-Tagheader.robots.txt(server-rendered, reads the runtimeNOINDEX) remains the crawl gate for preview deploys.build.format: "file"+trailingSlash: "never". Prerendered pages are written asabout.html, notabout/index.html. With the directory layout Netlify redirected every/aboutlink to/about/./about/now redirects to/abouton both Netlify and the node target.Things to keep in mind
export const getStaticPaths = localeStaticPaths;. A page that needs the API or query params needsexport const prerender = false;.localizeHref("/about")), never absolute ones: there is no real origin at build time.Astro.cache.set()was dropped from the prerendered pages, static files don't need it.