Files
blog/templates/partials/nav.html

78 lines
2.0 KiB
HTML

{% if config.extra.nav.links %}
<header id="site-nav">
<nav>
<a href="#main" id="main-content" tabindex="0">Skip to main content</a>
<ul>
<li id="home">
<a href="{{ get_url(path='/') | safe }}"
{% if current_url | default(value='/') | trim_end_matches(pat='/') | safe == get_url(path='/') | safe %}
class="active"
{% endif %}>
{{ config.title }}
</a>
</li>
{% for link in config.extra.nav.links %}
{%- if link.url is matching('https?://') %}
<li class="link">
<a href="{{ link.url | safe }}"
{% if current_url | default(value='/') | safe == link.url | safe %}
class="active"
{% endif %}>
{{ link.name }}
</a>
</li>
{%- else %}
<li class="link">
<a href="{{ get_url(path=link.url | safe )}}"
{% if current_url | default(value='/') | safe == get_url(path=link.url) | safe %}
class="active"
{% endif %}>
{{ link.name }}
</a>
</li>
{%- endif %}
{% endfor %}
{% if config.extra.nav.show_feed %}
<li id="feed">
<a href="{{ get_url(path=config.feed_filename) | safe }}">
<i id="feed-icon" class="icon"></i>
<span>Feed</span>
</a>
</li>
{% endif %}
<li id="dropdown">
<details>
<summary>
<i id="menu-icon" class="icon"></i>
<span>Menu</span>
</summary>
<ul>
{% for link in config.extra.nav.links %}
{%- if link.url is matching('https?://') %}
<li>
<a href="{{ link.url | safe }}"
{% if current_url | default(value='/') | safe == link.url | safe %}
class="active"
{% endif %}>
{{ link.name }}
</a>
</li>
{%- else %}
<li>
<a href="{{ get_url(path=link.url | safe )}}"
{% if current_url | default(value='/') | safe == get_url(path=link.url) | safe %}
class="active"
{% endif %}>
{{ link.name }}
</a>
</li>
{%- endif %}
{% endfor %}
</ul>
</details>
</li>
</ul>
</nav>
</header>
{% endif %}