Small helper which scans your Svelte routes and generates static sitemap.xml
- TypeScript, JavaScript, CLI version
- Useful options
- Compatible with Svelte
adapter-static
- Workaround for this official SvelteKit issue
via yarn
yarn add svelte-sitemap --dev
via npm
npm install svelte-sitemap --save-dev
svelte-sitemap --domain https://example.com
It scans your routes in build/
folder and generates build/sitemap.xml
file
import { createSitemap } from './src/index';
createSitemap('https://example.com', { debug: true });
Highly recommended to use as postbuild
hook in you package.json
{
"name": "my-project",
"scripts": {
"postbuild": "svelte-sitemap --domain https://mydomain.com"
}
}
Option | Description | default | example |
---|---|---|---|
-d, --domain | Use your domain (required) | https://example.com |
-d https://mydomain.com |
-o, --out-dir | Set custum build folder | build |
-o dist |
-r, --reset-time | Set lastModified time to now | false | -r |
-h, --help | Display this usage info | - | - |
-v, --version | Show version | - | - |
--debug | Show some useful logs | - | --debug |
I welcome you to customize this according to your needs ;)
Pull requests for any improvements would be great!
git clone git@github.com:bartholomej/svelte-sitemap.git
cd svelte-sitemap
yarn
yarn start
You can find and modify it in ./demo.ts
file
yarn demo
- svelte-sitemap is workaround for this official SvelteKit issue
- Brand new version is inspired by Richard's article
- Thanks to @auderer because his issue changed the direction of this library
If this project have helped you save time please consider making a donation for some 🍺 or 🍵 ;)
I DO NOT STORE ANY DATA. PERIOD.
I physically can't. I have nowhere to store it. I don't even have a server database to store it. So even if Justin Bieber asked nicely to see your data, I wouldn't have anything to show him.
That's why, with this library, what happens on your device stays on your device till disappear.
Copyright © 2021 Lukas Bartak
Proudly powered by nature 🗻, wind 💨, tea 🍵 and beer 🍺 ;)
All contents are licensed under the MIT license.