sitemax
v1.2.1
Published
Sitemap generator plugin
Downloads
19
Readme
Sitemax
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
Installation
Install via npm:
npm install sitemaxOr using yarn:
yarn add sitemaxUsage
Import 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();Options
| 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 |
Examples
// 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();Contributing
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
License
MIT © Neill Hewitt
