buildsomething/templates/_macros.html

59 lines
1.7 KiB
HTML
Raw Normal View History

2024-11-07 10:16:24 +01:00
{% macro render_header(path) %}
{% set root = get_section(path="_index.md") %}
<a href="{{ root.permalink | safe }}">
2024-11-05 21:59:02 +01:00
<div class="logo">
<img src="{{ get_url(path=config.extra.juice_logo_path) }}" alt="logo">
{{ config.extra.juice_logo_name }}
</div>
</a>
<nav>
{% if config.extra.juice_extra_menu %}
{% for menu in config.extra.juice_extra_menu %}
<a class="nav-item subtitle-text" href="{{ menu.link | safe }}">{{ menu.title }}</a>
{% endfor %}
{% endif %}
2024-11-07 10:16:24 +01:00
{% for page in root.pages %}
{% if lang == "en" %}
2024-11-05 21:59:02 +01:00
<a class="nav-item subtitle-text" href="{{ page.permalink | safe }}">{{ page.title }}</a>
2024-11-07 10:16:24 +01:00
{% else %}
<a class="nav-item subtitle-text" href="/{{lang}}{{ page.path }}">{{ page.title }}</a>
{% endif %}
2024-11-05 21:59:02 +01:00
{% endfor %}
2024-11-07 10:16:24 +01:00
{% for path in root.subsections %}
2024-11-06 12:15:43 +01:00
{% set child = get_section(path=path) %}
2024-11-07 10:16:24 +01:00
{% if lang == "en"%}
<a class="nav-item subtitle-text" href="{{ child.permalink | safe }}">{{ child.title }}</a>
{% else %}
<a class="nav-item subtitle-text" href="/{{lang}}{{ child.path }}">{{ child.title }}</a>
{% endif %}
2024-11-06 12:15:43 +01:00
{% endfor %}
2024-11-07 10:16:24 +01:00
{% if lang == "en"%}
2024-11-08 12:53:41 +01:00
<a class="nav-item subtitle-text" href="/sv{{ path }}"><img alt="swedish" class="flag"
src="/flag-for-sweden-svgrepo-com.svg"></a>
2024-11-07 10:16:24 +01:00
{% else %}
2024-11-08 12:53:41 +01:00
<a class="nav-item subtitle-text" href="{{ path }}"><img alt="english" class="flag"
2024-11-07 10:42:29 +01:00
src="/flag-for-united-kingdom-svgrepo-com.svg"></a>
2024-11-07 10:16:24 +01:00
{% endif %}
2024-11-08 13:10:54 +01:00
2024-11-09 20:49:46 +01:00
<div class='toggle-switch'>
<label>
2024-11-09 22:31:00 +01:00
<input type='checkbox' _="on click or load if me.checked
log('checked')
add .dark to the closest <body/>
else
remove .dark from the closest <body/>
">
2024-11-09 20:49:46 +01:00
<span class='slider'></span>
</label>
</div>
2024-11-08 13:10:54 +01:00
2024-11-09 22:31:00 +01:00
<!-- if i am <:checked/> -->
2024-11-05 21:59:02 +01:00
</nav>
{% endmacro render_header %}