Skip to content
Snippets Groups Projects
Unverified Commit 829d4882 authored by Tom Wiesing's avatar Tom Wiesing
Browse files

Optimize the menu a lot

parent d1b38277
No related branches found
No related tags found
No related merge requests found
......@@ -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 %}
......
{% 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>
......
{% 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment