kerouac-sitemap

0.5.0 • Public • Published

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/>

Readme

Keywords

Package Sidebar

Install

npm i kerouac-sitemap

Weekly Downloads

2

Version

0.5.0

License

MIT

Unpacked Size

11.6 kB

Total Files

9

Last publish

Collaborators

  • jaredhanson