Skip to content

Commit 9f9d396

Browse files
committed
Update index URLs to point to the new site index and add route for site index
1 parent e7bbc84 commit 9f9d396

File tree

5 files changed

+5
-4
lines changed

5 files changed

+5
-4
lines changed

packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/index/route.ts renamed to packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/site-index/route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface RawIndexPage {
1515
description?: string;
1616
}
1717

18+
export const revalidate = 86400; // 1 day in seconds
1819
export const dynamic = 'force-static';
1920

2021
export async function GET(

packages/gitbook/src/components/Header/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export function Header(props: {
162162
}
163163
siteSpace={siteSpace}
164164
siteSpaces={visibleSiteSpaces}
165-
indexURL={context.linker.toPathInSite('~gitbook/index')}
165+
indexURL={context.linker.toPathInSite('~gitbook/site-index')}
166166
viewport={!withTopHeader ? 'mobile' : undefined}
167167
searchURL={context.linker.toPathInSpace('~gitbook/search')}
168168
/>

packages/gitbook/src/components/SiteLayout/SiteLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export async function SiteLayout(props: {
4141

4242
// We also preload the site index
4343
//TODO: enable this only for a subset of website first
44-
ReactDOM.preload(`${context.linker.siteBasePath}~gitbook/index`, {
44+
ReactDOM.preload(`${context.linker.siteBasePath}~gitbook/site-index`, {
4545
as: 'fetch',
4646
type: 'application/json',
4747
});

packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export function SpaceLayout(props: SpaceLayoutProps) {
201201
siteSpace={siteSpace}
202202
siteSpaces={visibleSiteSpaces}
203203
indexURL={context.linker.toPathInSite(
204-
'~gitbook/index'
204+
'~gitbook/site-index'
205205
)}
206206
viewport="desktop"
207207
searchURL={context.linker.toPathInSpace(

packages/gitbook/src/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ function encodePathInSiteContent(
658658
case 'robots.txt':
659659
case '~gitbook/embed/script.js':
660660
case '~gitbook/embed/demo':
661-
case '~gitbook/index':
661+
case '~gitbook/site-index':
662662
// LLMs.txt, sitemap, sitemap-pages and robots.txt are always static
663663
// as they only depend on the site structure / pages.
664664
return { pathname, routeType: 'static' };

0 commit comments

Comments
 (0)