Enable macros for nav item listing

This commit is contained in:
Emil Miler 2024-01-09 23:20:06 +01:00
parent 7cfcf011ce
commit 5e5706b55d
3 changed files with 17 additions and 3 deletions

View File

@ -12,3 +12,9 @@ external_links_no_follow = true
external_links_no_referrer = true
[extra]
nav = [
{title = "Informace", path = "/informace/"},
{title = "Personál", path = "/personal/"},
{title = "Kontakt", path = "/kontakt/"},
{title = "Přihlášky", path = "https://prihlasky.kocandaci.cz", external = true}
]

View File

@ -1,3 +1,4 @@
{% import "macros.html" as macros %}
<!DOCTYPE html>
<html lang="cs">
<head>
@ -12,9 +13,7 @@
<div class="wrap">
<a href="{{ config.base_url }}"><img src="img/logo.svg" class="logo"></a>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
{{ macros::nav_items() }}
</ul>
</div>
</nav>

9
templates/macros.html Normal file
View File

@ -0,0 +1,9 @@
{% macro nav_items() %}
{% for item in config.extra.nav %}
{% if item.external %}
<li><a class="external" href="{{ item.path }}">{{ item.title }}</a></li>
{% else %}
<li><a href="{{ item.path }}">{{ item.title }}</a></li>
{% endif %}
{% endfor %}
{% endmacro %}