forked from kittv/web
1
0
Fork 0

Generování subsekcí v navigaci pomocí makra

search
Emil Miler 4 years ago
parent 0c5c1572e3
commit 325f2527d7

@ -8,10 +8,10 @@ build_search_index = false
[extra] [extra]
nav_primary = [ nav_primary = [
{path = "", name = "Katedra"}, {path = "katedra", name = "Katedra"},
{path = "", name = "Uchazeči"}, {path = "uchazeci", name = "Uchazeči"},
{path = "", name = "Studenti"}, {path = "studenti", name = "Studenti"},
{path = "", name = "Vědecká činnost"} {path = "vedecka-cinnost", name = "Vědecká činnost"}
] ]
nav_secondary = [ 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) }} {{ macro::nav_list_items(items=config.extra.nav_secondary) }}
</nav> </nav>
<nav class="primary"> <nav class="primary">
{{ macro::nav_list_items(items=config.extra.nav_primary) }} {{ macro::nav_list_items_recursive(items=config.extra.nav_primary) }}
</nav> </nav>
</section> </section>
</div> </div>

@ -6,7 +6,28 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% 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) %} {% macro breadcrumbs(page) %}
<div class="breadcrumbs"> <div class="breadcrumbs">
@ -22,7 +43,7 @@
</ul> </ul>
</div> </div>
</div> </div>
{% endmacro breadcrumbs %} {% endmacro %}
{% macro list_posts(section) %} {% macro list_posts(section) %}
{% for post in section.pages %} {% for post in section.pages %}
@ -56,4 +77,4 @@
</article> </article>
</a> </a>
{% endfor %} {% endfor %}
{% endmacro list_posts %} {% endmacro %}

Loading…
Cancel
Save