diff --git a/_includes/header.html b/_includes/header.html index 219afba8080ea7168f82778186b92e602d5da916..551f8b483f286bb300b887f2856b2bc9f68888fd 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -22,14 +22,6 @@ <a href="{{ site.baseurl }}/"><img src="{{ site.baseurl }}/public/kwarc_logo.svg" width="180px" height="180px"></a> </div> </li> - {% capture page_priors %} - {% for page in site.pages %} - {% assign value = page.menu_order %} - {% include print_number.liquid %}, - {% endfor %} - {% endcapture %} - - {% assign page_priors = page_priors | normalize_whitespace | replace: " ", "" | split:"," | uniq | sort | join: "," | append: "," %} {% for item in site.menu | sort:"menu_order %} {% if item.folder %} diff --git a/_includes/menu_sub.html b/_includes/menu_sub.html index a5e0c3e09ec09761579801b24a1c282a875e22bf..b4d7ef7e43849caf94495142809d31cecf0dd9d5 100644 --- a/_includes/menu_sub.html +++ b/_includes/menu_sub.html @@ -1,6 +1,5 @@ {% comment %} This page creates a submenu item. It expects an appropriate `item` as argument. - Furthermore, it requires the page_priors global variable {% endcomment %} {% unless item.menu_hidden %} @@ -18,22 +17,18 @@ {% assign menu_active = true %} {% endif %} - <!-- find all our priorities and also check for activity --> - {% capture priors %} - {{ page_priors }} + <!-- check if we are in the current oder --> {% for item in item.items %} - {% unless item.menu_page %} - {% unless item.external_page %} - {% if item.url == page.url %} - {% assign menu_active = true %} - {% endif %} + {% unless item.menu_page %} + {% unless item.external_page %} + {% if item.url == page.url %} + {% assign menu_active = true %} + {% endif %} + {% endunless %} {% endunless %} - {% endunless %} - {% assign value = item.menu_order %} - {% include print_number.liquid %}, {% endfor %} - {% endcapture %} - {% assign priors = priors | normalize_whitespace | replace: " ", "" | split:"," | uniq | sort %} + + {% assign pages = site.pages | sort: "menu_order"%} <!-- Find the current folder --> {% assign item_folder = item.folder %} @@ -50,21 +45,9 @@ </a> <div class="collapsible-body"> <ul> - <!-- Start by iteratig over the priorities --> - {% for p in priors %} - <!-- If we have folders, iterate over them --> {% if item.folder %} - {% for item in site.pages %} - - <!-- read item priority --> - {% assign value = item.menu_order %} - {% capture ip %}{% include print_number.liquid %}{% endcapture %} - {% assign ip = ip | normalize_whitespace | replace: " ", "" %} - - <!-- pick all the ones with the current priority --> - {% if ip == p %} - + {% for item in pages %} <!-- get the current page --> {% assign sub_parts = item.url | split: '/' %} {% assign sub_url = sub_parts | last %} @@ -74,30 +57,16 @@ {% if sub_folder == item_folder %} {% include menu_single.html %} {% endif %} - - {% endif %} - {% endfor %} {% endif %} <!-- if we have items, iterate over them --> {% if item.items %} - {% for item in item.items %} - <!-- read item priority --> - {% assign value = item.menu_order %} - {% capture ip %}{% include print_number.liquid %}{% endcapture %} - {% assign ip = ip | normalize_whitespace | replace: " ", "" %} - - <!-- pick all the ones with the current priority --> - {% if ip == p %} - - {% include menu_single.html %} - - {% endif %} + {% assign sitems = item.items | sort: "menu_order"%} + {% for item in sitems %} + {% include menu_single.html %} {% endfor %} - {% endif %} - {% endfor %} </ul> </div> </li> diff --git a/_includes/print_number.liquid b/_includes/print_number.liquid deleted file mode 100644 index e72d51aa13c2fa387f9accd6605ec23297b6735a..0000000000000000000000000000000000000000 --- a/_includes/print_number.liquid +++ /dev/null @@ -1,10 +0,0 @@ -{% if value == null %} - {% assign value = site.defaults[0].values["menu_order"] %} -{% endif %} - -{% if value < 10 %}0{% endif %} -{% if value < 100 %}0{% endif %} -{% if value < 1000 %}0{% endif %} -{% if value < 10000 %}0{% endif %} - -{{value}} \ No newline at end of file