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:
Tom Manner 2024-05-05 04:29:54 -04:00 committed by GitHub
parent 244eff763a
commit 64b1d429a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 17 deletions

View File

@ -1,10 +1,10 @@
{% assign navigation = site.data.navigation[include.nav] %}
<nav class="nav__list">
{% 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" />
<label for="ac-toc">{{ site.data.ui-text[site.locale].menu_label | default: "Toggle Menu" }}</label>
<ul class="nav__items">
{% for navname in include.nav %}
{% assign navigation = site.data.navigation[navname] %}
{% for nav in navigation %}
<li>
{% if nav.url %}
@ -22,5 +22,6 @@
{% endif %}
</li>
{% endfor %}
{% endfor %}
</ul>
</nav>

View File

@ -747,6 +747,15 @@ defaults:
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