Skip to content

Commit e5c83a2

Browse files
authored
Fix #21 The left sidebar always shows child items (#22)
* Fix #21 The left sidebar always shows child items. With this commit it checks if the section is selected then it shows everything below that section or if a node is selected only shows its children. * version bump to 0.0.17 Signed-off-by: vsoch <[email protected]> Co-authored-by: vsoch <[email protected]>
1 parent 9006542 commit e5c83a2

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Critical items to know are:
1414
- changed behaviour
1515

1616
## [master](https://github.com/vsoch/docsy-jekyll/tree/master)
17+
- hiding sidebar links to reflect parent functionality (0.0.17)
1718
- adding breadcrumb link to documentation root (0.0.16)
1819
- bug with link in top breadcrumb (404) missing baseurl (0.0.15)
1920
- bug that news items (posts) don't render in search (0.0.14)

Diff for: VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.16
1+
0.0.17

Diff for: _includes/sidebar.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
</form>
77
<nav class="collapse td-sidebar-nav pt-2 pl-4" id="td-section-nav">
88
{% for section in site.data.toc %}<ul class="td-sidebar-nav__section pr-md-3">
9+
{% capture sectionUrl %}{{ section.url | replace: "/", "" }}{% endcapture %}
10+
{% capture pageUrl %}{{ page.url | replace: "/", "" }}{% endcapture %}
911
<li class="td-sidebar-nav__section-title">
1012
<a href="{% if section.url %}{{ site.baseurl }}/{{ section.url }}{% else %}{{ section.external_url }}{% endif %}" class="align-left pl-0 pr-2 active td-sidebar-link td-sidebar-link__section">{{ section.title }}</a>
1113
</li>{% if section.links %}<ul>
@@ -14,9 +16,10 @@
1416
<li class="td-sidebar-nav__section-title">
1517
<a href="{% if entry.url %}{{ site.baseurl }}/{{ entry.url }}{% else %}{{ entry.external_url }}{% endif %}" class="align-left pl-0 pr-2 td-sidebar-link td-sidebar-link__section">{{ entry.title }}</a>
1618
</li>
19+
{% if page.url contains entry.url or pageUrl == sectionUrl %}
1720
<ul><li class="collapse show" id="{{ child.title | slugify }}">{% if entry.children %}
1821
{% for child in entry.children %}<a class="td-sidebar-link td-sidebar-link__page " id="m-{{ section.title | slugify }}-{{ entry.title | slugify }}-{{ child.title | slugify }}" href="{% if child.url %}{{ site.baseurl }}/{{ child.url }}{% else %}{{ child.external_url }}{% endif %}">{{ child.title }}</a>{% endfor %}
19-
{% endif %}</li></ul>{% endfor %}
22+
{% endif %}</li></ul>{% endif %}{% endfor %}
2023
</ul>{% endif %}{% endfor %}
2124
</nav>
2225
</div>

0 commit comments

Comments
 (0)