Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect support for group index & navOrder to control left nav option #943

Merged
merged 4 commits into from
Jul 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ module.exports = function(eleventyConfig) {
if (!accumulator[currentValue]) {
accumulator[currentValue] = {
'name': currentValue,
'url': page.url,
'url': page.data.redirect || page.url,
'order': page.data.navOrder || 0,
joepavitt marked this conversation as resolved.
Show resolved Hide resolved
'children': {}
}
if (page.data.navTitle) {
Expand Down Expand Up @@ -439,7 +440,7 @@ module.exports = function(eleventyConfig) {

function sortChildren (a, b) {
// sort children by 'order', then alphabetical
return b.order - a.order || a.name.localeCompare(b.name)
return (b.order - a.order) || a.name.localeCompare(b.name)
joepavitt marked this conversation as resolved.
Show resolved Hide resolved
}

nav[tag].groups = Object.values(groups).sort(sortChildren)
Expand Down