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

Commit 43e0dc2

Browse files
chore(docs): enable page ordering by @sortorder tag
1 parent 976da56 commit 43e0dc2

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

docs/config/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ module.exports = function(config) {
2222
]);
2323

2424
config.append('processing.tagDefinitions', [
25-
require('./tag-defs/tutorial-step')
25+
require('./tag-defs/tutorial-step'),
26+
require('./tag-defs/sortOrder')
2627
]);
2728

2829
config.append('processing.defaultTagTransforms', [

docs/config/processors/pages-data.js

+14-7
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,20 @@ var navGroupMappers = {
119119
})];
120120
},
121121
pages: function(pages, area) {
122-
return [getNavGroup(pages, area, 'path', function(page) {
123-
return {
124-
name: page.name,
125-
href: page.path,
126-
type: 'page'
127-
};
128-
})];
122+
return [getNavGroup(
123+
pages,
124+
area,
125+
function(page) {
126+
return page.sortOrder || page.path;
127+
},
128+
function(page) {
129+
return {
130+
name: page.name,
131+
href: page.path,
132+
type: 'page'
133+
};
134+
}
135+
)];
129136
}
130137
};
131138

docs/config/tag-defs/sortOrder.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
name: 'sortOrder',
3+
transforms: function(doc, tag, value) {
4+
return parseInt(value, 10);
5+
}
6+
};

0 commit comments

Comments
 (0)