Skip to content

Commit 8a5712e

Browse files
authored
Merge pull request #137 from bittorala/bugfix/no-toc-in-base-theme
Fix TOC in base theme
2 parents db297c9 + bb94b79 commit 8a5712e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/mkdocs_print_site_plugin/js/print-site.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ Copy the table of contents from the sidebar's.
77
Only called when print-site-plugin option 'add_table_of_contents' is set to true
88
*/
99
function generate_toc() {
10-
const sidebar = document.body.getElementsByClassName("md-sidebar--secondary")[0];
10+
const sidebar = document.body.getElementsByClassName("md-sidebar--secondary")[0] ??
11+
document.getElementById("toc-collapse");
12+
1113
const sidebarToc = sidebar.getElementsByTagName("ul")[0];
1214

1315
var clonedToc = sidebarToc.cloneNode(true);

0 commit comments

Comments
 (0)