Generate sitemap.xml & robots.txt automatically for your static site with Vite + GitHub Pages support.
- Injects SEO meta tags
- Generates
sitemap.xml - Generates
robots.txt - Works with multi-page static sites
Install via npm:
npm install sitemaxOr using yarn:
yarn add sitemaxImport your plugin into your project:
// ES Modules
import Sitemax from 'sitemax';
// CommonJS
const Sitemax = require('sitemax');Initialize and use the plugin:
const plugin = new Sitemax({
siteUrl: 'https://your-site.com',
routes: ['/', '/about', '/contact'],
generateRobots: true
});
// Example usage
plugin.generateSitemap();
plugin.generateRobots();| Option | Type | Default | Description |
|---|---|---|---|
siteUrl |
string | '' |
Base URL of your site |
routes |
array | [] |
Pages to include in sitemap |
outputDir |
string | 'dist' |
Directory to output sitemap/robots |
generateRobots |
boolean | false |
Whether to generate robots.txt |
// Example 1: Generate both sitemap & robots.txt
plugin.generateSitemap();
plugin.generateRobots();
// Example 2: Custom output directory
const plugin2 = new Sitemax({
siteUrl: 'https://example.com',
outputDir: './public',
});
plugin2.generateSitemap();Contributions are welcome! Please open an issue or pull request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
MIT © Neill Hewitt
This is a multi-page demonstration site for the Vite SEO Plugin, which automatically:
- Injects SEO meta tags
- Generates
sitemap.xml - Generates
robots.txt - Works with multi-page static sites
index.html- Homeabout.html- Aboutservices.html- Servicesblog.html- Blogcontact.html- Contact
Each page includes a self-testing system that confirms the plugin is working.
pnpm i && pnpm dev