npm.io
0.5.0 • Published 2 years ago

kerouac-sitemap

Licence
MIT
Version
0.5.0
Deps
1
Size
11 kB
Vulns
0
Weekly
0
Stars
1

kerouac-sitemap

Kerouac middleware that generates sitemaps, informing search engines about pages that are available for crawling.

Install

$ npm install kerouac-sitemap

Usage

Declare a sitemap.xml route, using this middleware.

var sitemap = require('kerouac-sitemap');

site.page('/sitemap.xml', sitemap());

And map a sitemap.xml file when generating the site.

site.generate([
  sitemap.createMapper()
]);
Indexes

For a site that consists of multiple sections, each section can have its own sitemap with each sitemap listed in a sitemap index.

var sitemap = require('kerouac-sitemap');

var site = kerouac();

var docs = kerouac();
docs.page('/sitemap.xml', sitemap());

site.use('/docs', docs);
site.page('/sitemap.xml', sitemap());
site.page('/sitemap_index.xml', sitemap.index());

site.generate({
  '/docs': [
    sitemap.createMapper(),
  ],
  '/': [
    sitemap.createMapper({ index: true }),
  ],
});

License

The MIT License

Copyright (c) 2012-2022 Jared Hanson <https://www.jaredhanson.me/>

Keywords