mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Sidenav now shows current page
This commit is contained in:
parent
00b6cb631d
commit
d473ed8dc5
36
docs/_includes/f_sidebar_nav.html
Normal file
36
docs/_includes/f_sidebar_nav.html
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
{% if include.item.children %}
|
||||
|
||||
<a href="#submenu_{{include.id}}" aria-controls="submenu_{{include.id}}" data-toggle="collapse" aria-expanded="false" class="bd-toc-link dropdown-toggle">{{include.item.title}}</a>
|
||||
|
||||
{% assign pageurl = page.url | remove: '.html' %}
|
||||
|
||||
{% capture capturechild %}
|
||||
{% for child in include.item.children %}
|
||||
|
||||
|
||||
{% assign active = "" %}
|
||||
{% if pageurl == child.url %}
|
||||
{% assign active = "active bd-sidenav-active" %}
|
||||
{% endif %}
|
||||
|
||||
<li class="hello {{active}}">
|
||||
{% assign childid = include.id | append: '_' | append: forloop.index %}
|
||||
{% include f_sidebar_nav.html item=child id=childid %}
|
||||
</li>
|
||||
|
||||
{% endfor %}
|
||||
{% endcapture %}
|
||||
|
||||
{% assign show = "" %}
|
||||
{% if capturechild contains 'bd-sidenav-active' %}
|
||||
{% assign show = "show" %}
|
||||
{% endif %}
|
||||
|
||||
<ul class="collapse nav bd-sidenav {{show}}" id="submenu_{{include.id}}">
|
||||
{{ capturechild }}
|
||||
</ul>
|
||||
{% else %}
|
||||
|
||||
<a href="{{include.item.url | relative_url}}">{{include.item.title}}</a>
|
||||
{% endif %}
|
@ -1,37 +1,11 @@
|
||||
<div class="col-12 col-md-3 col-xl-2 bd-sidebar">
|
||||
|
||||
<nav class="collapse bd-links" id = "sidebar">
|
||||
|
||||
{% for category in site.data.navigation %}
|
||||
{% assign catid = forloop.index %}
|
||||
{% for child in site.data.navigation %}
|
||||
<div class="bd-toc-item">
|
||||
<a href="#submenu_{{catid}}" aria-controls="submenu_{{catid}}" data-toggle="collapse" aria-expanded="false" class="bd-toc-link dropdown-toggle">{{category.title}}</a>
|
||||
|
||||
<ul class="collapse nav bd-sidenav" id="submenu_{{catid}}">
|
||||
|
||||
{% for document in category.children %}
|
||||
{% assign docid = forloop.index %}
|
||||
<li>
|
||||
|
||||
{% if document.children %}
|
||||
<a href="#submenu_{{catid}}_{{docid}}" aria-controls="submenu_{{catid}}_{{docid}}" data-toggle="collapse" aria-expanded="false" class="bd-toc-link dropdown-toggle">{{document.title}}</a>
|
||||
<ul class="collapse nav bd-sidenav" id="submenu_{{catid}}_{{docid}}">
|
||||
{% for child in document.children %}
|
||||
<li>
|
||||
<a href="{{child.url | relative_url}}">{{child.title}}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<a href="{{document.url | relative_url}}">{{document.title}}</a>
|
||||
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% assign childid = ("submenu_" | append: forloop.index) %}
|
||||
{% include f_sidebar_nav.html item=child id=childid %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
</nav>
|
||||
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user