diff options
author | anoadragon453 <anoadragon453@users.noreply.github.com> | 2022-05-03 10:52:17 +0000 |
---|---|---|
committer | anoadragon453 <anoadragon453@users.noreply.github.com> | 2022-05-03 10:52:17 +0000 |
commit | 547bf0988ef81edb25fd0783b8d635108f614626 (patch) | |
tree | ef48e09c982427c8963c74bb0d428c5d42756b46 /latest/website_files | |
parent | deploy: 8d156ec0ba17d848581f18aa40ebfd76dda763d4 (diff) | |
download | synapse-547bf0988ef81edb25fd0783b8d635108f614626.tar.xz |
deploy: 7e6598bcf6cf63b4d04c27b9696ed8429b6ddff6
Diffstat (limited to 'latest/website_files')
-rw-r--r-- | latest/website_files/table-of-contents.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/latest/website_files/table-of-contents.js b/latest/website_files/table-of-contents.js index 0de5960b22..772da97fb9 100644 --- a/latest/website_files/table-of-contents.js +++ b/latest/website_files/table-of-contents.js @@ -75,6 +75,20 @@ function setTocEntry() { * Populate sidebar on load */ window.addEventListener('load', () => { + // Prevent rendering the table of contents of the "print book" page, as it + // will end up being rendered into the output (in a broken-looking way) + + // Get the name of the current page (i.e. 'print.html') + const pageNameExtension = window.location.pathname.split('/').pop(); + + // Split off the extension (as '.../print' is also a valid page name), which + // should result in 'print' + const pageName = pageNameExtension.split('.')[0]; + if (pageName === "print") { + // Don't render the table of contents on this page + return; + } + // Only create table of contents if there is more than one header on the page if (headers.length <= 1) { return; |