Skip to content

Commit 5a01937

Browse files
committed
Fix multiple highlighted headlines in TOC
Previously, multiple equally named headlines were highlighted as the current page, if the name was the same as on the actually current page. This issued showed up in the book, where for instance "Summary" was used more than once. Instead, here I am using the page ordinal instead of the title. It should be safe to assume that the page has a number, since otherwise it would not show up in the TOC, IIUC.
1 parent 7a5a4f4 commit 5a01937

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

_includes/sidebar-toc-multipage-overview.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ <h5 class="contents">Contents</h5>
3030
{% else %} <!-- this must be English, so get the other documents' titles -->
3131

3232
{% if pg.type %} <!-- if a type is set in a document, we add it as a class. Used in Scala book to diff between chapter and section -->
33-
<li class="type-{{ pg.type }}"><a {% if page.title == pg.title %}class="active"{% endif %} href="{{ site.baseurl }}{{ pg.url }}">{{ pg.title }}</a>{{toc}}</li>
33+
<li class="type-{{ pg.type }}"><a {% if page.num == pg.num %}class="active"{% endif %} href="{{ site.baseurl }}{{ pg.url }}">{{ pg.title }}</a>{{toc}}</li>
3434
{% else %}
35-
<li><a {% if page.title == pg.title %}class="active"{% endif %} href="{{ site.baseurl }}{{ pg.url }}">{{ pg.title }}</a>{{toc}}</li>
35+
<li><a {% if page.num == pg.num %}class="active"{% endif %} href="{{ site.baseurl }}{{ pg.url }}">{{ pg.title }}</a>{{toc}}</li>
3636
{% endif %}
3737
{% endif %}
3838
{% endif %}

0 commit comments

Comments
 (0)