diff --git a/assets/scss/custom.scss b/assets/scss/custom.scss index 7cdc35ce..047e57d7 100644 --- a/assets/scss/custom.scss +++ b/assets/scss/custom.scss @@ -68,9 +68,8 @@ Custom SCSS for the Matrix spec margin-top: 1rem; } - &>.td-sidebar-nav__section > li > a.td-sidebar-link { - font-weight: $font-weight-bold; - font-size: 1.3rem; + .td-sidebar-nav__section .ul-1 ul { + padding-left: 0; } /* This is to make the width of the items that have sub-items (like room versions) @@ -79,12 +78,20 @@ Custom SCSS for the Matrix spec padding-right: 0 !important; } - a.indent-1 { + .ul-1 > li > a { padding-left: 1rem !important; } - a.indent-2 { - padding-left: 2rem; + .ul-2 > li > a { + padding-left: 2rem !important; + } + + a.td-sidebar-link.tree-root { + color: $gray-800; + font-weight: $font-weight-bold; + font-size: 1.3rem; + margin-bottom: 0; + border-bottom: none; } a, a.td-sidebar-link { @@ -103,7 +110,6 @@ Custom SCSS for the Matrix spec &.active, &active:hover { background-color: $secondary-background; - font-weight: $font-weight-normal; } } } diff --git a/changelogs/internal/newsfragments/1551.clarification b/changelogs/internal/newsfragments/1551.clarification new file mode 100644 index 00000000..b9f32571 --- /dev/null +++ b/changelogs/internal/newsfragments/1551.clarification @@ -0,0 +1 @@ +Fix the sidebar in recent versions of Hugo diff --git a/config.toml b/config.toml index 00757bd5..c6f1bd45 100644 --- a/config.toml +++ b/config.toml @@ -62,6 +62,10 @@ current_version_url = "https://spec.matrix.org/latest" footer_about_disable = false # Collapse HTTP API and event
elements rendered_data_collapsed = false +# Hide the search entry in the sidebar +sidebar_search_disable = true +# Only show the current page's ancestors, siblings and direct descendants in the sidebar menu +sidebar_menu_compact = true [params.links] # End user relevant links. These will show up on left side of footer and in the community page if you have one. diff --git a/layouts/partials/sidebar-tree.html b/layouts/partials/sidebar-tree.html deleted file mode 100644 index 3589868e..00000000 --- a/layouts/partials/sidebar-tree.html +++ /dev/null @@ -1,61 +0,0 @@ -{{/* - - A version of the sidebar-tree.html partial in Docsy, with a few small - modifications: - - * include `div#toc` for the ToC - * start the sidebar at the root (homepage) since for us that is the Matrix - overview page - -*/}} - -{{/* We cache this partial for bigger sites and set the active class client side. */}} -{{ $shouldDelayActive := ge (len .Site.Pages) 2000 }} -
-
- -
-
- -
- -{{ define "section-tree-nav-section" }} - {{ $s := .section }} - {{ $p := .page }} - {{ $shouldDelayActive := .delayActive }} - {{ $indent := .indent }} - {{ $active := eq $p.RelPermalink $s.RelPermalink }} - {{ $show := or ($p.IsAncestor $s) ($p.IsDescendant $s) }} - {{ $sid := $s.RelPermalink | anchorize }} - -{{ end }} diff --git a/static/js/toc.js b/static/js/toc.js index fa36ba4a..6386e40d 100644 --- a/static/js/toc.js +++ b/static/js/toc.js @@ -111,11 +111,18 @@ function makeToc() { const section = makeTocSection(tocTargets, 0); nav.appendChild(section.content); - // append title and content to the #toc placeholder - const toc = document.body.querySelector("#toc"); + // build the TOC and append to it title and content + const toc = document.createElement("div"); + toc.id = "toc"; toc.appendChild(title); toc.appendChild(nav); + // append TOC to the section navigation + const section_nav = document.body.querySelector("#td-section-nav"); + let hr = document.createElement("hr"); + section_nav.appendChild(hr); + section_nav.appendChild(toc); + // tell ToC items about any rendered-data headings they contain setTocItemChildren(section.content, headings); }