Multiple Sidebar Nav Lists (#2843)
Co-authored-by: Tom Manner <tsmanner@us.ibm.com> Co-authored-by: iBug <git@ibugone.com>
This commit is contained in:
parent
244eff763a
commit
64b1d429a4
@ -1,26 +1,27 @@
|
|||||||
{% assign navigation = site.data.navigation[include.nav] %}
|
|
||||||
|
|
||||||
<nav class="nav__list">
|
<nav class="nav__list">
|
||||||
{% if page.sidebar.title %}<h3 class="nav__title" style="padding-left: 0;">{{ page.sidebar.title }}</h3>{% endif %}
|
{% if page.sidebar.title %}<h3 class="nav__title" style="padding-left: 0;">{{ page.sidebar.title }}</h3>{% endif %}
|
||||||
<input id="ac-toc" name="accordion-toc" type="checkbox" />
|
<input id="ac-toc" name="accordion-toc" type="checkbox" />
|
||||||
<label for="ac-toc">{{ site.data.ui-text[site.locale].menu_label | default: "Toggle Menu" }}</label>
|
<label for="ac-toc">{{ site.data.ui-text[site.locale].menu_label | default: "Toggle Menu" }}</label>
|
||||||
<ul class="nav__items">
|
<ul class="nav__items">
|
||||||
{% for nav in navigation %}
|
{% for navname in include.nav %}
|
||||||
<li>
|
{% assign navigation = site.data.navigation[navname] %}
|
||||||
{% if nav.url %}
|
{% for nav in navigation %}
|
||||||
<a href="{{ nav.url | relative_url }}"><span class="nav__sub-title">{{ nav.title }}</span></a>
|
<li>
|
||||||
{% else %}
|
{% if nav.url %}
|
||||||
<span class="nav__sub-title">{{ nav.title }}</span>
|
<a href="{{ nav.url | relative_url }}"><span class="nav__sub-title">{{ nav.title }}</span></a>
|
||||||
{% endif %}
|
{% else %}
|
||||||
|
<span class="nav__sub-title">{{ nav.title }}</span>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if nav.children != null %}
|
{% if nav.children != null %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for child in nav.children %}
|
{% for child in nav.children %}
|
||||||
<li><a href="{{ child.url | relative_url }}"{% if child.url == page.url %} class="active"{% endif %}>{{ child.title }}</a></li>
|
<li><a href="{{ child.url | relative_url }}"{% if child.url == page.url %} class="active"{% endif %}>{{ child.title }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -747,6 +747,15 @@ defaults:
|
|||||||
nav: "docs"
|
nav: "docs"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you have multiple sidebar navs defined and want to include more than one on a page, the sidebar nav can also be a list.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
sidebar:
|
||||||
|
nav:
|
||||||
|
- main
|
||||||
|
- docs
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Social sharing links
|
## Social sharing links
|
||||||
|
Loading…
x
Reference in New Issue
Block a user