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 external_links_no_referrer = true
[extra] [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> <!DOCTYPE html>
<html lang="cs"> <html lang="cs">
<head> <head>
@ -12,9 +13,7 @@
<div class="wrap"> <div class="wrap">
<a href="{{ config.base_url }}"><img src="img/logo.svg" class="logo"></a> <a href="{{ config.base_url }}"><img src="img/logo.svg" class="logo"></a>
<ul> <ul>
<li><a href="#">Home</a></li> {{ macros::nav_items() }}
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul> </ul>
</div> </div>
</nav> </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 %}