A Vite plugin that automatically generates a sitemap.xml (and optional robots.txt) for your static site — zero configuration beyond your route list.
A Vite plugin that automatically generates a sitemap.xml for your static site.
npm install @3ni8ma/vite-plugin-sitemap// vite.config.ts
import { defineConfig } from 'vite'
import sitemap from '@3ni8ma/vite-plugin-sitemap'
export default defineConfig({
plugins: [
sitemap({
hostname: 'https://example.com',
routes: [
'/',
'/about',
'/projects',
'/contact',
],
changefreq: 'monthly',
priority: 0.7,
}),
],
})| Option | Type | Default | Description |
|---|---|---|---|
hostname |
string |
required | Your site's base URL |
routes |
string[] |
required | Array of route paths |
changefreq |
string |
'monthly' |
Sitemap change frequency |
priority |
number |
0.7 |
Page priority (0.0–1.0) |
lastmod |
Date |
new Date() |
Last modified date |
outDir |
string |
build.outDir | Output directory |
robotsTxt |
boolean |
true |
Auto-generate robots.txt |
disallow |
string[] |
[] |
Paths to disallow in robots.txt |
MIT