Commit 26f9f90e authored by Yohan Jarosz's avatar Yohan Jarosz

fix navbar collapse

parent a9b6cefa
......@@ -17,29 +17,39 @@
{% capture prefix %}{{brand[0]}}{% endcapture %}
{% endif %}
<nav role="navigation" class="navbar navbar-default navbar-static-top">
<nav role="navigation" class="navbar navbar-collapse navbar-default navbar-static-top" aria-expended="true">
<div class="container-fluid">
{% if page.index %}
{% assign brand = page.index | split:"$" %}
<a class="navbar-brand" href="{{ site.baseurl }}{{prefix}}">{{brand[1]}}</a>
{% endif %}
<ul class="nav navbar-nav">
{% if page.nav %}
{% capture indexurl %}{{ site.baseurl }}{{prefix}}{% endcapture %}
{% capture indexurl2 %}{{ site.baseurl }}{{prefix}}index.html{% endcapture %}
{% assign navs = page.nav | split:"," %}
{% for nav in navs %}
{% assign link = nav | split:"$" %}
{% assign myurl = link[0] %}
{% if myurl contains '://' %}
<li><a href="{{myurl}}">{{link[1]}}</a></li>
{% elsif myurl == 'index' and (page.url == indexurl or page.url == indexurl2) %}
<li class="active"><a href="{{ site.baseurl }}{{prefix}}{{myurl}}.html">{{link[1]}}</a></li>
{% else %}
<li class="{% if page.url contains myurl and myurl != '/index' and myurl != 'index' %}active{% endif %}"><a href="{{ site.baseurl }}{{prefix}}{{myurl}}.html">{{link[1]}}</a></li>
{% endif %}
{% endfor %}
</ul>
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
{% if page.index %}
{% assign brand = page.index | split:"$" %}
<a class="navbar-brand" href="{{ site.baseurl }}{{prefix}}">{{brand[1]}}</a>
{% endif %}
</div>
<div class="collapse navbar-collapse" id="navbar-collapse">
<ul class="nav navbar-nav">
{% if page.nav %}
{% capture indexurl %}{{ site.baseurl }}{{prefix}}{% endcapture %}
{% capture indexurl2 %}{{ site.baseurl }}{{prefix}}index.html{% endcapture %}
{% assign navs = page.nav | split:"," %}
{% for nav in navs %}
{% assign link = nav | split:"$" %}
{% assign myurl = link[0] %}
{% if myurl contains '://' %}
<li><a href="{{myurl}}">{{link[1]}}</a></li>
{% elsif myurl == 'index' and (page.url == indexurl or page.url == indexurl2) %}
<li class="active"><a href="{{ site.baseurl }}{{prefix}}{{myurl}}.html">{{link[1]}}</a></li>
{% else %}
<li class="{% if page.url contains myurl and myurl != '/index' and myurl != 'index' %}active{% endif %}"><a href="{{ site.baseurl }}{{prefix}}{{myurl}}.html">{{link[1]}}</a></li>
{% endif %}
{% endfor %}
</ul>
</div>
{% endif %}
</div>
</nav>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment