Zuby.js sitemap plugin
The plugin for Zuby.js that automatically generates a sitemap.xml file for your website
from your pages.
First, install the @zubyjs/sitemap package using your favorite package manager.
If you aren't sure, you can use npm:
``sh`
npm install @zubyjs/sitemap
Then add the @zubyjs/sitemap plugin to your zuby.config.mjs file under the plugins option:
`diff lang="js" title="zuby.config.mjs"
import { defineConfig } from 'zuby';
import preact from '@zubyjs/preact';
+ import sitemap from '@zubyjs/sitemap';
export default defineConfig({
outDir: '.zuby',
jsx: preact(),
+ plugins: [
+ sitemap()
+ ]
^^^^^^^^
});
`
The plugin will automatically add link to the generated sitemap to the head of your HTML pages.
And that's it! Now you can run zuby build and the sitemap.xml file will be generated.
NOTE: Always make sure that all zuby packages are in sync in your package.json file:
`diff lang="json"``
{
"name": "my-zuby-app",
"version": "1.0.0",
"dependencies": {
"zuby": "latest",
"@zubyjs/sitemap": "latest"
}
}
This package is part of Zuby.js workspace and maintained by the team behind the Zuby package.
Please refer to it for more details how to contribute.
MIT