From 6287d8a6da59b09df4bca317eaca414abda9e349 Mon Sep 17 00:00:00 2001 From: John Mertic Date: Mon, 4 Jul 2022 15:27:20 -0400 Subject: [PATCH] Add 'child_nav_order' front matter to be able to sort navigation pages in reverse (#726) Set `child_nav_order` to `desc` to reverse the sort order for a child section. Co-authored-by: Matt Wang --- _includes/nav.html | 10 +++++++++- docs/navigation-structure.md | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/_includes/nav.html b/_includes/nav.html index accfd89..a2aa2d6 100644 --- a/_includes/nav.html +++ b/_includes/nav.html @@ -66,7 +66,11 @@ {%- endif -%} {{ node.title }} {%- if node.has_children -%} - {%- assign children_list = pages_list | where: "parent", node.title -%} + {%- if node.child_nav_order == 'desc' -%} + {%- assign children_list = pages_list | where: "parent", node.title | reverse -%} + {%- else -%} + {%- assign children_list = pages_list | where: "parent", node.title -%} + {%- endif -%}