Sitemap
Rspress provides an official @rspress/plugin-sitemap plugin that helps you generate sitemap.xml files for search engine optimization.
Installation
Add the sitemap plugin to your project:
Configuration
Add the sitemap plugin to rspress.config.ts:
Configuration Options
Example
How It Works
The sitemap plugin automatically generates a sitemap.xml file in the root of your build output directory. This file contains all the pages of your documentation site, which helps search engines crawl and index your content more efficiently.
Verification
After building your site, you can check if the sitemap.xml file has been generated by looking at the build output directory. The sitemap should be accessible at https://your-domain.com/sitemap.xml.
Benefits
- Improved SEO: Helps search engines discover and index all pages of your site
- Better crawl efficiency: Search engines can crawl your site more efficiently with a sitemap
- Indexing control: You can control which pages are indexed and their priority
Notes
- The
siteUrlmust be the full URL of your deployed site (including protocol) - For GitHub Pages, the
siteUrlshould be in the format:https://username.github.io/repository/ - The sitemap is generated during the build process, so you need to rebuild your site whenever you add new pages