WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions docs/start/framework/react/guide/static-prerendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,59 @@ Note: Dynamic routes can still be prerendered if they are linked from other page
When `crawlLinks` is enabled (default: `true`), TanStack Start will extract links from prerendered pages and prerender those linked pages as well.

For example, if `/` contains a link to `/posts`, then `/posts` will also be automatically prerendered.

## Sitemap Generation

TanStack Start can automatically generate a `sitemap.xml` file from your prerendered pages. To enable sitemap generation, add the `sitemap` option:

```ts
tanstackStart({
prerender: {
enabled: true,
},
sitemap: {
host: 'https://example.com', // Required: Your site's base URL
},
})
```

### Excluding Pages from Sitemap

You can exclude specific pages from the sitemap using the `pages` config:

```ts
tanstackStart({
prerender: { enabled: true },
sitemap: { host: 'https://example.com' },
pages: [
{
path: '/admin',
sitemap: { exclude: true },
},
{
path: '/blog',
sitemap: {
priority: 0.8,
changefreq: 'daily',
lastmod: '2025-01-01',
},
},
],
})
```

### Available Sitemap Options

- `host` - **Required.** The base URL of your site
- `enabled` - Enable/disable sitemap generation (default: `true`)
- `outputPath` - Output filename (default: `sitemap.xml`)

### Per-Page Sitemap Options

- `exclude` - Exclude the page from sitemap
- `priority` - Priority from 0.0 to 1.0
- `changefreq` - Frequency of changes to the page, one of `never`, `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly`
- `lastmod` - Last modification date
- `alternateRefs` - Array of alternate language URLs
- `images` - Array of images
- `news` - News sitemap extension
Loading