Skip to content

Commit 5f368d5

Browse files
committed
sidebar: make TOC collapsible with <details>
Use semantic HTML to make the table of contents in the sidebar collapsible.
1 parent 1f2050d commit 5f368d5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

layouts/partials/sidebar.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@
5353

5454
{{ $headings := .Params.headings }}
5555
{{ if $headings }}
56-
<ul id="toc">
57-
<li> Table of Contents
58-
<ul class="expanded">
56+
<details id="toc" open>
57+
<summary>Table of Contents</summary>
58+
<ul>
5959
{{ range $i, $item := $headings }}
6060
<li><a href="#{{ .id }}">{{ .text }}</a> </li>
6161
{{ end }}
6262
</ul>
6363
</li>
64-
</ul>
64+
</details>
6565
{{ end }}
6666

6767
{{ if (eq .Params.Sidebar "book") }}

0 commit comments

Comments
 (0)