Navigation mit 2 Ebenen generiert aus Databag hinzugefügt.
This commit is contained in:
parent
0a94a0fba4
commit
368e28bdfd
26
databags/navigation.json
Normal file
26
databags/navigation.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"home": {
|
||||
"href": "/",
|
||||
"items": {}
|
||||
},
|
||||
"about": {
|
||||
"href": "/about",
|
||||
"items": {}
|
||||
},
|
||||
"specs": {
|
||||
"href": "/specs",
|
||||
"list_childs": true,
|
||||
"items": {
|
||||
"members": "/members",
|
||||
"lines of code": "/lines_of_code"
|
||||
}
|
||||
},
|
||||
"mission": {
|
||||
"href": "/faq",
|
||||
"items": {}
|
||||
},
|
||||
"legal": {
|
||||
"href": "/member",
|
||||
"items": {}
|
||||
}
|
||||
}
|
@ -42,17 +42,28 @@
|
||||
</div>
|
||||
|
||||
<ul class="nav__navlist">
|
||||
<li class="nav__navitem {% if this._path == '/' %}-active{% endif %}">
|
||||
<a class="nav__navlink {% if this._path == '/' %}-active{% endif %}" href="{{ '/'|url }}">home</a>
|
||||
{% for title, mapping in bag("navigation").items() %}
|
||||
<li class="nav__navitem
|
||||
{%- if this._path == mapping.href or mapping.href != '/' and this.is_child_of(mapping.href) %}
|
||||
-active
|
||||
{%- endif -%}
|
||||
">
|
||||
<a class="nav__navlink {% if this._path == mapping.href %}-active{% endif %}" href="{{ mapping.href|url }}">
|
||||
{{ title }}
|
||||
</a>
|
||||
{% if mapping.list_childs %}
|
||||
<ul class="nav__sub_navlist">
|
||||
{% set sub_menu = mapping['items'].items() %}
|
||||
{% for sub_title, href in sub_menu %}
|
||||
<li class="nav__sub_navitem {%- if this._path == href %} -active{%- endif %}">
|
||||
<a class="nav__navlink {% if this._path == href %}-active{% endif %}" href="{{ href|url }}">
|
||||
{{ sub_title }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% for href, title in [
|
||||
['/about', 'about'],
|
||||
['/specs', 'specs'],
|
||||
['/legal', 'legal']
|
||||
]
|
||||
%}
|
||||
<li class="nav__navitem {% if this.is_child_of(href) %}-active{% endif %}">
|
||||
<a class="nav__navlink {% if this.is_child_of(href) %}-active{% endif %}" href="{{ href|url }}">{{ title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
|
Loading…
Reference in New Issue
Block a user