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:
parent
d17f26d9b4
commit
17d5e8ebe0
4 changed files with 5 additions and 1 deletions
|
@ -4,6 +4,7 @@ defaults:
|
||||||
path: ""
|
path: ""
|
||||||
values:
|
values:
|
||||||
layout: "page"
|
layout: "page"
|
||||||
|
menuorder: 100
|
||||||
langs:
|
langs:
|
||||||
de: "DE"
|
de: "DE"
|
||||||
en: "EN"
|
en: "EN"
|
||||||
|
|
|
@ -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.lang == page.lang and node.menutitle -%}
|
||||||
{%- if node.url == page.url -%}
|
{%- if node.url == page.url -%}
|
||||||
<li><a href="{{ node.url }}" class="is-active">{{ node.menutitle | escape }}</a></li>
|
<li><a href="{{ node.url }}" class="is-active">{{ node.menutitle | escape }}</a></li>
|
||||||
|
|
|
@ -3,6 +3,7 @@ title: The friendly neighborhood undead tech community
|
||||||
menutitle: Home
|
menutitle: Home
|
||||||
lang: en
|
lang: en
|
||||||
ref: home
|
ref: home
|
||||||
|
menuorder: 0
|
||||||
---
|
---
|
||||||
|
|
||||||
# Welcome to Zombi
|
# Welcome to Zombi
|
||||||
|
|
1
index.md
1
index.md
|
@ -3,6 +3,7 @@ title: The friendly neighborhood undead tech community
|
||||||
menutitle: Startseite
|
menutitle: Startseite
|
||||||
lang: de
|
lang: de
|
||||||
ref: home
|
ref: home
|
||||||
|
menuorder: 0
|
||||||
---
|
---
|
||||||
|
|
||||||
# Willkommen bei Zombi
|
# Willkommen bei Zombi
|
||||||
|
|
Loading…
Reference in a new issue