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 @@