2018-01-21 12:24:05 -05:00
|
|
|
module.exports = function createSitemap() {
|
|
|
|
return {
|
2019-04-07 14:58:03 -04:00
|
|
|
ignoredDocTypes: [
|
2019-04-07 12:58:25 -04:00
|
|
|
'announcements-json',
|
2018-02-07 05:46:37 -05:00
|
|
|
'contributors-json',
|
2019-04-07 12:58:25 -04:00
|
|
|
'navigation-json',
|
2018-02-07 05:46:37 -05:00
|
|
|
'resources-json',
|
|
|
|
],
|
2019-04-07 14:58:03 -04:00
|
|
|
ignoredPaths: [
|
2018-02-07 05:46:37 -05:00
|
|
|
'file-not-found',
|
2019-04-07 12:58:25 -04:00
|
|
|
'overview-dump',
|
|
|
|
'test',
|
2018-02-07 05:46:37 -05:00
|
|
|
],
|
2018-01-21 12:24:05 -05:00
|
|
|
$runAfter: ['paths-computed'],
|
|
|
|
$runBefore: ['rendering-docs'],
|
|
|
|
$process(docs) {
|
|
|
|
docs.push({
|
|
|
|
id: 'sitemap.xml',
|
|
|
|
path: 'sitemap.xml',
|
|
|
|
outputPath: '../sitemap.xml',
|
|
|
|
template: 'sitemap.template.xml',
|
2018-02-07 05:46:37 -05:00
|
|
|
urls: docs
|
|
|
|
// Filter out docs that are not outputted
|
|
|
|
.filter(doc => doc.outputPath)
|
|
|
|
// Filter out unwanted docs
|
2019-04-07 14:58:03 -04:00
|
|
|
.filter(doc => this.ignoredDocTypes.indexOf(doc.docType) === -1)
|
|
|
|
.filter(doc => this.ignoredPaths.indexOf(doc.path) === -1)
|
2018-02-07 05:46:37 -05:00
|
|
|
// Capture the path of each doc
|
|
|
|
.map(doc => doc.path)
|
|
|
|
// Convert the homepage: `index` to `/`
|
|
|
|
.map(path => path === 'index' ? '' : path)
|
2018-01-21 12:24:05 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|