Skip to content

Commit 8240799

Browse files
authored
remove inactive sidebar links (github#16500)
1 parent 5bd61aa commit 8240799

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

includes/sidebar-specific-product.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@
2323
<summary>
2424
<div class="d-flex flex-justify-between">
2525
<a href="{{fullPathToCategory}}" class="pl-4 pr-2 py-2 f6 text-uppercase d-block flex-auto mr-3">{{ category[1].title }}</a>
26+
{% if breadcrumbs.category.href == category[1].href or forloop.index < 4 %}
2627
<svg xmlns="http://www.w3.org/2000/svg" class="octicon flex-shrink-0 arrow mr-3" style="margin-top:7px" viewBox="0 0 16 16" width="16" height="16"> <path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></svg>
28+
{% endif %}
2729
</div>
2830
</summary>
2931
{% endif %}
3032
<!-- some categories have maptopics with child articles -->
33+
{% if breadcrumbs.category.href == category[1].href or forloop.index < 4 %}
3134
{% if category[1].maptopics %}
3235
<ul class="sidebar-topics list-style-none position-relative">
3336
{% for maptopic in category[1].maptopics %}
@@ -60,6 +63,7 @@
6063
{% endfor %}
6164
</ul>
6265
{% endif %}
66+
{% endif %}
6367
</details>
6468
</li>
6569
{% endfor %}

javascripts/sidebar.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function () {
1212
menu.scrollTo(0, activeMenuItemPosition)
1313
}
1414

15-
// if the active cagetory is a standalone category, do not close the other open dropdowns
15+
// if the active category is a standalone category, do not close the other open dropdowns
1616
const activeStandaloneCategory = document.querySelectorAll('.sidebar-category.active.standalone-category')
1717
if (activeStandaloneCategory.length) return
1818

@@ -21,6 +21,8 @@ export default function () {
2121
if (allOpenDetails) {
2222
for (const openDetail of allOpenDetails) {
2323
openDetail.removeAttribute('open')
24+
const svgArrowElem = openDetail.querySelector('summary > div > svg')
25+
svgArrowElem.remove()
2426
}
2527
}
2628
}

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)