An open API service indexing awesome lists of open source software.

https://github.com/jenbuzz/express-simple-sitemap

:world_map: The simplest way to add a sitemap to an express application
https://github.com/jenbuzz/express-simple-sitemap

express express-middleware expressjs sitemap sitemap-generator sitemap-xml

Last synced: 8 months ago
JSON representation

:world_map: The simplest way to add a sitemap to an express application

Awesome Lists containing this project

README

          

[![Build Status](https://secure.travis-ci.org/jenbuzz/express-simple-sitemap.png?branch=master)](http://travis-ci.org/jenbuzz/express-simple-sitemap) [![Coverage Status](https://coveralls.io/repos/github/jenbuzz/express-simple-sitemap/badge.svg?branch=master)](https://coveralls.io/github/jenbuzz/express-simple-sitemap?branch=master)

# express-simple-sitemap
The simplest way to add a sitemap to an express application.

## Installation

```bash
$ npm install express-simple-sitemap
```
or
```bash
$ yarn add express-simple-sitemap
```

## Usage

```javascript
// express setup
const express = require('express');
const app = express();

// import express-simple-sitemap
const sitemap = require('express-simple-sitemap');

// add express-simple-sitemap as middleware
app.use(sitemap({
sitemapUrl: '/sitemap.xml', // optional, default value is '/sitemap.xml'
urls: [
{
url: 'https://github.com/jenbuzz',
lastmod: '2018-12-08', // optional
changefreq: 'daily', // optional
priority: 1.0, // optional
},
{
url: 'https://github.com/jenbuzz/express-simple-sitemap',
},
]
}));
```

Output:
```xml


https://github.com/jenbuzz
2018-12-08
daily
1


https://github.com/jenbuzz/express-simple-sitemap

```

## License
This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)