Skip to content

Commit 9390beb

Browse files
committed
Sidebar: Added toc to sidebar
1 parent e8de09c commit 9390beb

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

assets/css/v2/style.css

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ atomic-search-layout atomic-layout-section[section="search"] {
529529
max-height: 100vh;
530530
overflow: hidden;
531531
scrollbar-gutter: stable;
532+
scrollbar-width: none;
532533
}
533534

534535
.sidebar .scrollbar-container:hover {
@@ -698,7 +699,7 @@ atomic-search-layout atomic-layout-section[section="search"] {
698699

699700
.sidebar .sidebar-navigation ul li .partial {
700701
margin-top: 0;
701-
top: calc(50% - 3.5px);
702+
top: 5px;
702703
left: -13px;
703704
}
704705

@@ -707,10 +708,7 @@ atomic-search-layout atomic-layout-section[section="search"] {
707708
position: relative;
708709
}
709710

710-
.sidebar
711-
.sidebar-navigation
712-
.parent-collapsible-content
713-
li:not(:only-child)::before {
711+
.sidebar .sidebar-navigation .parent-collapsible-content:first-child::before {
714712
content: "";
715713
position: absolute;
716714
border-left: black 1px solid;
@@ -719,6 +717,16 @@ atomic-search-layout atomic-layout-section[section="search"] {
719717
height: calc(100% - 9px - 10px);
720718
}
721719

720+
.sidebar
721+
.sidebar-navigation
722+
.parent-collapsible-content
723+
li:not(:only-child)
724+
a
725+
+ :not(:has(#TableOfContents))
726+
li::before {
727+
border: none;
728+
}
729+
722730
/* First Sidebar Nav Horizontal Lines */
723731
.sidebar
724732
.sidebar-navigation
@@ -748,6 +756,22 @@ atomic-search-layout atomic-layout-section[section="search"] {
748756
align-items: flex-start;
749757
}
750758

759+
/* Table of Contents */
760+
#TableOfContents {
761+
/* Close all TOC on sidebar */
762+
display: none;
763+
}
764+
765+
.collapsible-content li ul li:has(.current) > nav {
766+
/* Open TOC for current page */
767+
display: block !important;
768+
}
769+
770+
#TableOfContents li {
771+
position: relative;
772+
list-style: square;
773+
}
774+
751775
/* content */
752776
main {
753777
flex: 1;

layouts/partials/sidebar-list-pages.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
<span class="box-link partial"></span>
2121
{{ end }}
2222
<a href="{{ .Permalink }}" style="{{if eq $currentUrl .Permalink}}font-weight: bold;{{end}}">{{ .Title }} </a>
23+
{{- with .TableOfContents -}}
24+
{{- . -}}
25+
{{- end -}}
2326
{{ end }}
2427
</li>
2528
{{ end }}

0 commit comments

Comments
 (0)