https://github.com/kodedninja/nanositemap
Small sitemap generation utility
https://github.com/kodedninja/nanositemap
Last synced: 10 months ago
JSON representation
Small sitemap generation utility
- Host: GitHub
- URL: https://github.com/kodedninja/nanositemap
- Owner: kodedninja
- Created: 2019-07-13T13:48:33.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-16T06:39:50.000Z (over 6 years ago)
- Last Synced: 2025-04-19T00:41:28.314Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
Small sitemap generation utility based on the [official protocol](https://www.sitemaps.org/protocol.html).
## installation
```
npm i nanositemap
```
## example
```javascript
var nanositemap = require('nanositemap')
var sm = nanositemap('https://hex22.org', {
'/': { lastmod: '2019-07-13', priority: 0.8 },
'/blog': { lastmod: '2019-05-11', priority: 0.2 },
'/blog/are-you-the-owner': {}
})
// or simply
var sm = nanositemap('https://hex22.org', ['/', '/blog', '/blog/are-you-the-owner'])
```
## API
### `nanositemap(str, obj|arr) -> str`
Exposes a simple function that returns the full XML string. Firstly, the base url of your site and then an array of strings (urls) or an object with the following format:
```
{
'/:url': {
lastmod: string,
changefreq: string,
priority: number
}
}
```
In the object, all attributes are optional and everything else will be filtered out.