From 6de0cd8b66b82ba929ae3d523dcc6b127bbc962a Mon Sep 17 00:00:00 2001 From: afernandez-nhs Date: Mon, 21 Jul 2025 10:48:38 +0100 Subject: [PATCH] fix(navigation): restore original sidebar order for Features section - Separate pages without sections from pages with sections - Display pages without sections at top, sorted by nav_order - Render sections below in configured order from sidebar-section-order.yml - Fixes issue where Roadmap and Security appeared at bottom instead of top - Maintains logical information hierarchy for better UX --- docs/_layouts/page.html | 42 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/docs/_layouts/page.html b/docs/_layouts/page.html index a3a87d1..3675251 100644 --- a/docs/_layouts/page.html +++ b/docs/_layouts/page.html @@ -18,11 +18,30 @@ | group_by: "section" -%} +{%- comment -%} +Separate pages with sections from pages without sections +{%- endcomment -%} +{%- assign pages_without_sections = "" | split: "" -%} +{%- assign pages_with_sections = "" | split: "" -%} + +{%- for section in first_level -%} + {%- if section.name == "" or section.name == nil -%} + {%- assign pages_without_sections = pages_without_sections | concat: section.items -%} + {%- else -%} + {%- assign pages_with_sections = pages_with_sections | push: section -%} + {%- endif -%} +{%- endfor -%} + +{%- comment -%} +Sort pages without sections by nav_order +{%- endcomment -%} +{%- assign sorted_pages_without_sections = pages_without_sections | sort: 'nav_order' -%} + {%- assign section_order = site.data.sidebar-section-order.sections -%} {%- assign ordered_sections = "" | split: "" -%} {%- for section_name in section_order -%} - {%- for section in first_level -%} + {%- for section in pages_with_sections -%} {%- if section.name == section_name -%} {%- assign ordered_sections = ordered_sections | push: section -%} {%- break -%} @@ -33,7 +52,7 @@ {%- comment -%} Add any sections not in the manual order list at the end {%- endcomment -%} -{%- for section in first_level -%} +{%- for section in pages_with_sections -%} {%- assign found = false -%} {%- for ordered_section in ordered_sections -%} {%- if section.name == ordered_section.name -%} @@ -55,6 +74,25 @@