Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aminnairi/rollup-plugin-sitemap
Sitemap generator
https://github.com/aminnairi/rollup-plugin-sitemap
generator plugin rollup sitemap xml
Last synced: about 5 hours ago
JSON representation
Sitemap generator
- Host: GitHub
- URL: https://github.com/aminnairi/rollup-plugin-sitemap
- Owner: aminnairi
- License: gpl-3.0
- Created: 2022-09-09T09:43:55.000Z (about 2 years ago)
- Default Branch: development
- Last Pushed: 2024-03-29T17:00:25.000Z (8 months ago)
- Last Synced: 2024-10-02T11:08:40.381Z (about 1 month ago)
- Topics: generator, plugin, rollup, sitemap, xml
- Language: TypeScript
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# @aminnairi/rollup-plugin-sitemap
Sitemap generator
## Installation
```bash
npm install rollup @aminnairi/rollup-plugin-sitemap
touch rollup.config.js
```## Configuration
```javascript
import { defineConfig } from "rollup"
import { sitemap } from "@aminnairi/rollup-plugin-sitemap"export default defineConfig({
input: "index.js",
plugins: [
sitemap({
baseUrl: "https://domain.com",
urls: [
{ location: "/" },
{ location: "/about" }
{ location: "/contact" }
]
})
],
output: {
file: "build/index.js",
format: "cjs"
}
})
``````xml
cat build/sitemap.xml
https://domain.com/
https://domain.com/about
https://domain.com/contact
```
## Configuration with last modification
```javascript
import { defineConfig } from "rollup"
import { sitemap } from "@aminnairi/rollup-plugin-sitemap"export default defineConfig({
input: "index.js",
plugins: [
sitemap({
baseUrl: "https://domain.com",
urls: [
{
location: "/",
lastModified: new Date()
},
{
location: "/about",
lastModified: new Date()
}
{
location: "/contact",
lastModified: new Date()
}
]
})
],
output: {
file: "build/index.js",
format: "cjs"
}
})
``````xml
cat build/sitemap.xml
https://domain.com/
2022-09-09
https://domain.com/about
2022-09-09
https://domain.com/contact
2022-09-09
```
## Configuration with change frequency
```javascript
import { defineConfig } from "rollup"
import { sitemap } from "@aminnairi/rollup-plugin-sitemap"export default defineConfig({
input: "index.js",
plugins: [
sitemap({
baseUrl: "https://domain.com",
urls: [
{
location: "/",
changeFrequency: "monthly"
},
{
location: "/about",
changeFrequency: "monthly"
}
{
location: "/contact",
changeFrequency: "monthly"
}
]
})
],
output: {
file: "build/index.js",
format: "cjs"
}
})
``````xml
cat build/sitemap.xml
https:/domain.com/
monthly
https:/domain.com/about
monthly
https:/domain.com/contact
monthly
```
## Configuration with priority
```javascript
import { defineConfig } from "rollup"
import { sitemap } from "@aminnairi/rollup-plugin-sitemap"export default defineConfig({
input: "index.js",
plugins: [
sitemap({
baseUrl: "https://domain.com",
urls: [
{
location: "/",
priority: 1
},
{
location: "/about",
priority: 1
}
{
location: "/contact",
priority: 1
}
]
})
],
output: {
file: "build/index.js",
format: "cjs"
}
})
``````xml
cat build/sitemap.xml
https:/domain.com/
1
https:/domain.com/about
1
https:/domain.com/contact
1
```
## Contributing
See [`CONTRIBUTING.md`](./CONTRIBUTING.md).
## License
See [`LICENSE`](./LICENSE).