diff --git a/_includes/nav.html b/_includes/nav.html index d561a42..a691f4f 100644 --- a/_includes/nav.html +++ b/_includes/nav.html @@ -1,6 +1,8 @@ - {%- assign pages_list = site.html_pages | sort:"nav_order" -%} + {%- assign ordered_pages_list = site.html_pages | where_exp:"item", "item.nav_order != nil" | sort:"nav_order" -%} + {%- assign unordered_pages_list = site.html_pages | where_exp:"item", "item.nav_order == nil" | sort:"title" -%} + {%- assign pages_list = ordered_pages_list | concat: unordered_pages_list -%} {%- for node in pages_list -%} {%- unless node.nav_exclude -%} {%- if node.parent == nil -%} @@ -10,7 +12,7 @@ {%- endif -%} {{ node.title }} {%- if node.has_children -%} - {%- assign children_list = site.html_pages | where: "parent", node.title | sort:"nav_order" -%} + {%- assign children_list = pages_list | where: "parent", node.title -%} {%- for child in children_list -%} @@ -19,7 +21,7 @@ {%- endif -%} {{ child.title }} {%- if child.has_children -%} - {%- assign grand_children_list = site.html_pages | where: "parent", child.title | sort:"nav_order" -%} + {%- assign grand_children_list = pages_list | where: "parent", child.title -%} {%- for grand_child in grand_children_list -%} diff --git a/_layouts/default.html b/_layouts/default.html index b1d3c72..1aa6ae1 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -74,9 +74,8 @@ layout: table_wrappers {% if page.has_children == true and page.has_toc != false %} Table of contents - {% assign children_list = site.pages | sort:"nav_order" %} - {% for child in children_list %} + {% for child in pages_list %} {% if child.parent == page.title and child.title != page.title %} {{ child.title }}{% if child.summary %} - {{ child.summary }}{% endif %}