Generování subsekcí v navigaci pomocí makra

remotes/1722757888236843906/tmp_refs/heads/search
Emil Miler 4 years ago
parent 0c5c1572e3
commit 325f2527d7

@ -8,10 +8,10 @@ build_search_index = false
[extra]
nav_primary = [
{path = "", name = "Katedra"},
{path = "", name = "Uchazeči"},
{path = "", name = "Studenti"},
{path = "", name = "Vědecká činnost"}
{path = "katedra", name = "Katedra"},
{path = "uchazeci", name = "Uchazeči"},
{path = "studenti", name = "Studenti"},
{path = "vedecka-cinnost", name = "Vědecká činnost"}
]
nav_secondary = [

@ -0,0 +1,4 @@
+++
title = "Katedra"
+++

@ -0,0 +1,4 @@
+++
title = "Galerie"
+++

@ -0,0 +1,4 @@
+++
title = "Sídlo pracoviště"
+++

@ -0,0 +1,4 @@
+++
title = "Učebny"
+++

@ -0,0 +1,4 @@
+++
title = "Zaměstnanci"
+++

@ -0,0 +1,4 @@
+++
title = "Studenti"
+++

@ -0,0 +1,4 @@
+++
title = "Formuláře"
+++

@ -0,0 +1,4 @@
+++
title = "Uchazeči"
+++

@ -0,0 +1,4 @@
+++
title = "Přijímací řízení"
+++

@ -0,0 +1,4 @@
+++
title = "Vědecká činnost"
+++

@ -20,7 +20,7 @@
{{ macro::nav_list_items(items=config.extra.nav_secondary) }}
</nav>
<nav class="primary">
{{ macro::nav_list_items(items=config.extra.nav_primary) }}
{{ macro::nav_list_items_recursive(items=config.extra.nav_primary) }}
</nav>
</section>
</div>

@ -6,7 +6,28 @@
{% endfor %}
</ul>
{% endif %}
{% endmacro list_items %}
{% endmacro %}
{% macro nav_list_items_recursive(items) %}
{% if items %}
<ul>
{% for item in items %}
<li>
{% set section = get_section(path=item.path~"/_index.md") %}
<a href="{{ section.permalink }}">{{ section.title }}</a>
{% if section.subsections %}
<ul>
{% for subsection in section.subsections %}
{% set subsection = get_section(path=subsection) %}
<li><a href="{{ subsection.permalink }}">{{ subsection.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
{% macro breadcrumbs(page) %}
<div class="breadcrumbs">
@ -22,7 +43,7 @@
</ul>
</div>
</div>
{% endmacro breadcrumbs %}
{% endmacro %}
{% macro list_posts(section) %}
{% for post in section.pages %}
@ -56,4 +77,4 @@
</article>
</a>
{% endfor %}
{% endmacro list_posts %}
{% endmacro %}

Loading…
Cancel
Save