guide.deuxfleurs.fr/templates/_macros.html

35 lines
1.3 KiB
HTML
Raw Permalink Normal View History

2022-05-10 15:52:28 +00:00
{% macro render_header() %}
{% set root_section = get_section(path="_index.md") %}
{% set active_section = "" %}
{% if page and page.components %}
{% set active_section = page.components[0] %}
{% elif section and section.components %}
{% set active_section = section.components[0] %}
{% endif %}
2022-12-21 23:07:05 +00:00
<a href="{{ root_section.permalink }}">
2022-05-10 15:52:28 +00:00
<div class="logo">
<img src="{{ get_url(path=config.extra.juice_logo_path) }}" alt="logo">
{{ config.extra.juice_logo_name }}
</div>
</a>
<nav>
2022-12-21 23:07:05 +00:00
<ul>
{% for subpath in root_section.subsections %}
2022-12-21 23:07:05 +00:00
{% set sub = get_section(path=subpath) %}
{% set is_active = sub.components[0] == active_section %}
{% if not 'hide_from_menu' in sub.extra or not sub.extra.hide_from_menu %}
<li>
<a class="nav-item text{% if is_active %} active{% endif %}" href="{{ sub.permalink }}">{{ sub.title }}</a>
</li>
{% endif %}
2022-05-10 15:52:28 +00:00
{% endfor %}
2022-12-21 23:07:05 +00:00
{% if config.extra.juice_extra_menu %}
{% for menu in config.extra.juice_extra_menu %}
<li><a class="nav-item text" href="{{ menu.link }}">{{ menu.title }}</a></li>
2022-12-21 23:07:05 +00:00
{% endfor %}
{% endif %}
</ul>
2022-05-10 15:52:28 +00:00
</nav>
2022-05-11 15:53:45 +00:00
{% endmacro render_header %}