diff --git a/_includes/nav.html b/_includes/nav.html index 2c4bf1e..d561a42 100644 --- a/_includes/nav.html +++ b/_includes/nav.html @@ -1,44 +1,40 @@ - {% assign pages_list = site.html_pages | sort:"nav_order" %} - {% for node in pages_list %} - {% unless node.nav_exclude %} - {% if node.parent == nil %} + {%- assign pages_list = site.html_pages | sort:"nav_order" -%} + {%- for node in pages_list -%} + {%- unless node.nav_exclude -%} + {%- if node.parent == nil -%} - {% if page.parent == node.title or page.grand_parent == node.title %} - {% assign first_level_url = node.url | absolute_url %} - {% endif %} + {%- if page.parent == node.title or page.grand_parent == node.title -%} + {%- assign first_level_url = node.url | absolute_url -%} + {%- endif -%} {{ node.title }} - {% if node.has_children %} - {% assign children_list = site.html_pages | sort:"nav_order" %} + {%- if node.has_children -%} + {%- assign children_list = site.html_pages | where: "parent", node.title | sort:"nav_order" -%} - {% for child in children_list %} - {% if child.parent == node.title %} - - {% if page.url == child.url or page.parent == child.title %} - {% assign second_level_url = child.url | absolute_url %} - {% endif %} - {{ child.title }} - {% if child.has_children %} - {% assign grand_children_list = site.html_pages | sort:"nav_order" %} + {%- for child in children_list -%} + + {%- if page.url == child.url or page.parent == child.title -%} + {%- assign second_level_url = child.url | absolute_url -%} + {%- endif -%} + {{ child.title }} + {%- if child.has_children -%} + {%- assign grand_children_list = site.html_pages | where: "parent", child.title | sort:"nav_order" -%} - {% for grand_child in grand_children_list %} - {% if grand_child.parent == child.title %} - - {{ grand_child.title }} - - {% endif %} - {% endfor %} - - {% endif %} - - {% endif %} - {% endfor %} + {%- for grand_child in grand_children_list -%} + + {{ grand_child.title }} + + {%- endfor -%} + + {%- endif -%} + + {%- endfor -%} - {% endif %} + {%- endif -%} - {% endif %} - {% endunless %} - {% endfor %} + {%- endif -%} + {%- endunless -%} + {%- endfor -%}