A sitemap generator plugin for Vite projects using vite-ssg, built on top of sitemap-ts. Version 0.10.0, actively maintained. It automates sitemap.xml and robots.txt generation during static site builds. Key differentiators: tight integration with vite-ssg's lifecycle (onFinished hook), supports dynamic routes, route-level overrides for change frequency/priority/lastmod, i18n alternate links, and customizable output options. Simpler than full-featured sitemap libraries but specifically designed for the vite-ssg ecosystem.
npm install vite-ssg-sitemapVerified import paths — ran on the pinned version, not inferred.
Example of using generateSitemap in vite.config.ts with i18n, dynamic routes, exclusions, and readable XML.
Use `import generateSitemap from 'vite-ssg-sitemap'` (no braces).
Pass `hostname: 'https://yoursite.com'` in options.
Update your i18n config to { defaultLanguage?, languages: string[] }.Set `outDir` to match your Vite build output directory (default 'dist').
Manually collect routes and pass to `dynamicRoutes`. See README for example.
Use `import generateSitemap from 'vite-ssg-sitemap'` (default import).
Pass an array of route paths to `dynamicRoutes` in options.
Run `npm install -D sitemap-ts`.
Ensure all route strings are URL-encoded or sanitized.