{%- if page.parent == "/" -%} {%- assign searchurl = page.parent -%} {%- else -%} {%- assign searchurl = page.url -%} {%- endif -%} {%- assign col = site.collections | where: "label", page.collection | first -%} {%- if col.navigation -%} {%- assign currentsubnav = col.navigation -%} {%- else -%} {%- for item in site.data.navigation -%} {%- for i in item.pages -%} {%- if i.url == searchurl -%} {%- assign currentsubnav = item -%} {%- else -%} {%- for j in i.pages -%} {%- if j.url == searchurl -%} {%- assign currentsubnav = item -%} {%- else -%} {%- for k in j.pages -%} {%- if k.url == searchurl -%} {%- assign currentsubnav = item -%} {%- endif -%} {%- endfor -%} {%- endif -%} {%- endfor -%} {%- endif -%} {%- endfor -%} {%- endfor -%} {%- endif -%} {%- for i in currentsubnav.pages -%} {%- if forloop.first -%} {% endif -%} {%- endfor -%}