Home

Awesome

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());

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 }),
  ],
});

Authors

License

The MIT License

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