bmen-jekyll/_includes/navbar.html

61 lines
1.9 KiB
HTML
Raw Normal View History

2020-10-10 08:35:47 +00:00
<nav class="navbar navbar-expand-lg navbar-light">
<a class="navbar-brand" href="{{ site.baseurl }}/"><h5><b>{{ site.title }}</b></h5></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav ml-auto">
{%- assign html_pages = site.html_pages | sort: 'weight' -%}
{%- assign filtered_pages = "" | split: "" -%}
{%- for html_page in html_pages -%}
{%- assign exclude = false -%}
{%- for exclude_path in site.nav_exclude -%}
{%- if exclude_path == html_page.path -%}
{%- assign exclude = true -%}
{%- break -%}
{%- elsif exclude_path contains '**' -%}
{%- assign match = exclude_path | remove: '**' -%}
{%- if html_page.path contains match -%}
{%- assign exclude = true -%}
{%- break -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- unless exclude -%}
{%- assign filtered_pages = filtered_pages | push: html_page -%}
{%- endunless -%}
{%- endfor -%}
{% for html_page in filtered_pages %}
{%- if page.url contains html_page.url -%}
{%- assign active_status = "active" -%}
{%- else -%}
{%- assign active_status = "" -%}
{%- endif -%}
{%- if html_page.external_url -%}
{%- assign url = html_page.external_url -%}
{%- else -%}
{%- assign url = html_page.url | relative_url -%}
{%- endif -%}
<a class="nav-item nav-link {{ active_status }}" href="{{ url }}">{{ html_page.title }}</a>
{% endfor %}
</div>
</div>
</nav>