This project is a simple way to generate a sitemap for your project based on your routing file. It uses the sitemap library to generate the sitemap.
You can also setup your project to generate the sitemap each time you run your build, allowing your sitemap to always be up to date based on your project routes.
"build": "... node generate-sitemap.js"
Add additional routes to the routes
object in the generate-sitemap.js script.
routes = [...routes, "example-route"];
First, install the dependency sitemap:
yarn add sitemap
or npm install sitemap
Then add the file generate-sitemap.js to your project root folder and add the script to your package.json scripts property:
"sitemap": "node generate-sitemap.js"
Then run the script to generate your sitemap:
yarn sitemap
or npm run sitemap
- sitemap - https://github.com/ekalinin/sitemap.js
- typescript - https://www.npmjs.com/package/typescript