guide.deuxfleurs.fr/templates/_macros.html

34 lines
1.3 KiB
HTML

{% 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 %}
<a href="{{ root_section.permalink }}">
<div class="logo">
<img src="{{ get_url(path=config.extra.juice_logo_path) }}" alt="logo">
{{ config.extra.juice_logo_name }}
</div>
</a>
<nav>
<ul>
{% for subpath in root_section.subsections %}
{% 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 %}
{% endfor %}
{% 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>
{% endfor %}
{% endif %}
</ul>
</nav>
{% endmacro render_header %}