Browse Source

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.
master
madmaurice 4 years ago
parent
commit
17d5e8ebe0
  1. 1
      _config.yml
  2. 3
      _includes/menu.html
  3. 1
      index-en.md
  4. 1
      index.md

1
_config.yml

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

3
_includes/menu.html

@ -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>

1
index-en.md

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

1
index.md

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

Loading…
Cancel
Save