mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-10-14 17:19:42 +00:00
Keep static-only routes static when a theme is forced
A ?theme= param or x-gitbook-theme cookie switched every route to the dynamic tree, but markdown, llms.txt, rss and sitemap routes only exist under static, so they 404'd. Site previews always persist the theme cookie, which made View as Markdown 404 there. Fixes RND-12749
This commit is contained in:
@@ -496,7 +496,9 @@ async function serveSiteRoutes(requestURL: URL, request: NextRequest) {
|
||||
themeMode === CustomizationThemeMode.Dark
|
||||
? CustomizationDefaultThemeMode.Dark
|
||||
: CustomizationDefaultThemeMode.Light;
|
||||
} else {
|
||||
} else if (routeTypeFromPathname !== 'static') {
|
||||
// Markdown, llms.txt, RSS and sitemap routes only exist under `sites/static`, so
|
||||
// forcing them dynamic 404s. They don't render a theme anyway. RND-12749.
|
||||
routeType = 'dynamic';
|
||||
requestHeaders.set(MiddlewareHeaders.Theme, themeMode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user