Skip to content

Commit 93b8188

Browse files
committed
docs: add sitemap generation section to static prerendering guide
1 parent bfbe75c commit 93b8188

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

docs/start/framework/react/guide/static-prerendering.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,59 @@ Note: Dynamic routes can still be prerendered if they are linked from other page
8686
When `crawlLinks` is enabled (default: `true`), TanStack Start will extract links from prerendered pages and prerender those linked pages as well.
8787

8888
For example, if `/` contains a link to `/posts`, then `/posts` will also be automatically prerendered.
89+
90+
## Sitemap Generation
91+
92+
TanStack Start can automatically generate a `sitemap.xml` file from your prerendered pages. To enable sitemap generation, add the `sitemap` option:
93+
94+
```ts
95+
tanstackStart({
96+
prerender: {
97+
enabled: true,
98+
},
99+
sitemap: {
100+
host: 'https://example.com', // Required: Your site's base URL
101+
},
102+
})
103+
```
104+
105+
### Excluding Pages from Sitemap
106+
107+
You can exclude specific pages from the sitemap using the `pages` config:
108+
109+
```ts
110+
tanstackStart({
111+
prerender: { enabled: true },
112+
sitemap: { host: 'https://example.com' },
113+
pages: [
114+
{
115+
path: '/admin',
116+
sitemap: { exclude: true },
117+
},
118+
{
119+
path: '/blog',
120+
sitemap: {
121+
priority: 0.8,
122+
changefreq: 'daily',
123+
lastmod: '2025-01-01',
124+
},
125+
},
126+
],
127+
})
128+
```
129+
130+
### Available Sitemap Options
131+
132+
- `host` - **Required.** The base URL of your site
133+
- `enabled` - Enable/disable sitemap generation (default: `true`)
134+
- `outputPath` - Output filename (default: `sitemap.xml`)
135+
136+
### Per-Page Sitemap Options
137+
138+
- `exclude` - Exclude the page from sitemap
139+
- `priority` - Priority from 0.0 to 1.0
140+
- `changefreq` - Frequency of changes to the page, one of `never`, `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly`
141+
- `lastmod` - Last modification date
142+
- `alternateRefs` - Array of alternate language URLs
143+
- `images` - Array of images
144+
- `news` - News sitemap extension

0 commit comments

Comments
 (0)