Sitemap generator plugin for Vite that integrates with vite-plugin-pages to automatically generate sitemaps from file-based routing. Version 1.7.1 is the current stable release. The plugin is actively maintained. Key differentiators: it leverages the routes generated by vite-plugin-pages, supports dynamic routes, i18n with alternate links, custom hostname, exclusion patterns, and configuration for changefreq, priority, lastmod, and readable XML output. It also integrates with Nuxt.js style route naming and can generate a robots.txt. Alternative to generic sitemap generators when using vite-plugin-pages.
npm install vite-plugin-pages-sitemapVerified import paths — ran on the pinned version, not inferred.
Basic setup integrating vite-plugin-pages and generating a sitemap on routes generation.
Update to >=1.0.0 and adjust config to use new API: pass options to generateSitemap directly.
Use onRoutesGenerated hook as shown in quickstart.
Ensure vite-plugin-pages is installed: npm install -D vite-plugin-pages
Manually add dynamic routes to the routes array as shown in README.
Pass hostname option with production URL.
Run npm install -D vite-plugin-pages-sitemap
Use import generateSitemap from 'vite-plugin-pages-sitemap';
Ensure you pass routes option with an array of route objects or strings.