kerouac-sitemap
v0.5.0
Published
Sitemap middleware for Kerouac.
Downloads
6
Readme
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
Copyright (c) 2012-2022 Jared Hanson <https://www.jaredhanson.me/>