Skip to content

Commit 88cbc97

Browse files
committed
split up generic TOC include depending on whether there are children or not
1 parent 0093f2e commit 88cbc97

3 files changed

Lines changed: 31 additions & 19 deletions

File tree

includes/generic-toc-items.html

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,12 @@
11
{% if tocItems %}
22

33
{% for tocItem in tocItems %}
4+
45
{% assign title = tocItem.title %}
56
{% assign fullPath = tocItem.fullPath %}
67
{% assign intro = tocItem.intro %}
7-
8-
{% if tocItem.childTocItems and page.documentType != "product" %}
9-
10-
<ul>
11-
<li>{% include liquid-tags/link %}
12-
<ul>
13-
{% for childItem in tocItem.childTocItems %}
14-
{% assign title = childItem.title %}
15-
{% assign fullPath = childItem.fullPath %}
16-
<li>{% include liquid-tags/link %}</li>
17-
{% endfor %}
18-
</ul>
19-
</li>
20-
</ul>
21-
22-
{% else %}
23-
248
{% include liquid-tags/link-with-intro %}
259

26-
{% endif %}
2710
{% endfor %}
11+
2812
{% endif %}

includes/generic-toc-list.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{% if tocItems %}
2+
<ul>
3+
{% for tocItem in tocItems %}
4+
5+
{% assign title = tocItem.title %}
6+
{% assign fullPath = tocItem.fullPath %}
7+
{% assign intro = tocItem.intro %}
8+
9+
<li>{% include liquid-tags/link %}
10+
{% if tocItem.childTocItems %}
11+
{% unless page.relativePath == "github/index.md" %}
12+
<ul>
13+
{% for childItem in tocItem.childTocItems %}
14+
{% assign title = childItem.title %}
15+
{% assign fullPath = childItem.fullPath %}
16+
<li>{% include liquid-tags/link %}</li>
17+
{% endfor %}
18+
</ul>
19+
{% endunless %}
20+
{% endif %}
21+
</li>
22+
{% endfor %}
23+
</ul>
24+
{% endif %}

layouts/generic-toc.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ <h1 class="border-bottom-0">{{ page.title }}</h1>
4747

4848
{{ renderedPage }}
4949

50-
{% include generic-toc-items %}
50+
{% if page.documentType == "category" or page.relativePath == "github/index.md" %}
51+
{% include generic-toc-list %}
52+
{% else %}
53+
{% include generic-toc-items %}
54+
{% endif %}
5155
</div>
5256
</div>
5357
</article>

0 commit comments

Comments
 (0)