Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit fbe679d

Browse files
committed
chore(doc-gen): generate sitemap.xml
1 parent fb00991 commit fbe679d

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

docs/config/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ module.exports = new Package('angularjs', [
3131
.processor(require('./processors/keywords'))
3232
.processor(require('./processors/pages-data'))
3333
.processor(require('./processors/versions-data'))
34+
.processor(require('./processors/sitemap'))
3435

3536

3637
.config(function(dgeni, log, readFilesProcessor, writeFilesProcessor) {

docs/config/processors/sitemap.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict';
2+
3+
var exclusionRegex = /^index|examples\/|ptore2e\//;
4+
5+
module.exports = function createSitemap() {
6+
return {
7+
$runAfter: ['paths-computed'],
8+
$runBefore: ['rendering-docs'],
9+
$process: function(docs) {
10+
docs.push({
11+
id: 'sitemap.xml',
12+
path: 'sitemap.xml',
13+
outputPath: '../sitemap.xml',
14+
template: 'sitemap.template.xml',
15+
urls: docs.filter(function(doc) {
16+
return doc.path &&
17+
doc.outputPath &&
18+
!exclusionRegex.test(doc.outputPath);
19+
}).map(function(doc) {
20+
return doc.path;
21+
})
22+
});
23+
}
24+
};
25+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3+
{%- for url in doc.urls %}
4+
<url>
5+
<loc>https://docs.angularjs.org/{$ url $}</loc>
6+
</url>{% endfor %}
7+
</urlset>

0 commit comments

Comments
 (0)