Add menu order feature

Menu items are now sorted by the menuorder attribute of their page.
As we have a page for each language, this attribute has to be set for both of
them.
The default value is 100. pages with equal value are sorted by name.
The index pages are set 0.
This commit is contained in:
madmaurice 2018-06-19 16:53:31 +02:00
parent d17f26d9b4
commit 17d5e8ebe0
4 changed files with 5 additions and 1 deletions

View file

@ -4,6 +4,7 @@ defaults:
path: ""
values:
layout: "page"
menuorder: 100
langs:
de: "DE"
en: "EN"

View file

@ -1,4 +1,5 @@
{%- for node in site.pages -%}
{% assign sorted_nodes = site.pages | sort:"menutitle" | sort:"menuorder" %}
{%- for node in sorted_nodes -%}
{%- if node.lang == page.lang and node.menutitle -%}
{%- if node.url == page.url -%}
<li><a href="{{ node.url }}" class="is-active">{{ node.menutitle | escape }}</a></li>

View file

@ -3,6 +3,7 @@ title: The friendly neighborhood undead tech community
menutitle: Home
lang: en
ref: home
menuorder: 0
---
# Welcome to Zombi

View file

@ -3,6 +3,7 @@ title: The friendly neighborhood undead tech community
menutitle: Startseite
lang: de
ref: home
menuorder: 0
---
# Willkommen bei Zombi