From f1abe6d0df95931e0b8dc7d87a8c07e17f539652 Mon Sep 17 00:00:00 2001 From: MoritzWeber Date: Tue, 14 Oct 2025 09:20:01 +0200 Subject: [PATCH 1/2] fix: Use relative position for toc indicator during scroll on mobile --- assets/sass/contentNavigation.scss | 47 ++++++++++++++++++++---------- layouts/partials/toc.html | 4 +-- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/assets/sass/contentNavigation.scss b/assets/sass/contentNavigation.scss index 2633cca3..1108dc9e 100644 --- a/assets/sass/contentNavigation.scss +++ b/assets/sass/contentNavigation.scss @@ -12,14 +12,12 @@ flex-wrap: wrap; height: fit-content; - ul, - ol { + ul { list-style-type: none; list-style-position: outside; padding-left: 0; - ul, - ol { + ul { margin-bottom: 0; } } @@ -47,11 +45,11 @@ list-style-type: none; } - ol { + ul { padding: 0 0 0 1em; } - > ol { + > ul { padding-left: 0; } } @@ -60,18 +58,35 @@ display: flex; } -.o-aside__toc a[data-current] { - font-weight: bold; +@mixin toc-indicator-nesting { + @for $i from 1 through 4 { + $selector: ""; + @for $j from 1 through $i { + $selector: $selector + "ul "; + } - &:before { - content: ""; - width: 0.4rem; - height: 2.1rem; - position: absolute; - display: flex; - left: 0; - background-color: var(--link-default); + #{$selector}a[data-current]:before { + left: calc(-#{$i - 1}em - 2.1rem); + } + } +} + +.o-aside__toc { + a[data-current] { + font-weight: bold; + position: relative; + + &:before { + content: ""; + width: 0.4rem; + height: 2.1rem; + position: absolute; + display: flex; + background-color: var(--link-default); + } } + + @include toc-indicator-nesting; } .o-related { diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index a2863ed8..72a00016 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -76,10 +76,10 @@ >{{ .Title | plainify | safeHTML }} {{- with and (lt .Level $ctx.endLevel) .Headings }} -
    +
+ {{- end }} {{- else }} From 05f003be7731a06f0066006fdf4de8973b28705b Mon Sep 17 00:00:00 2001 From: MoritzWeber0 Date: Sat, 18 Oct 2025 21:04:13 +0200 Subject: [PATCH 2/2] feat: Replace mixin with simpler rules and remove borders --- assets/sass/contentNavigation.scss | 37 +++++++++++------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/assets/sass/contentNavigation.scss b/assets/sass/contentNavigation.scss index 9f24518c..719718c0 100644 --- a/assets/sass/contentNavigation.scss +++ b/assets/sass/contentNavigation.scss @@ -56,29 +56,14 @@ padding: 0 0 0 1em; } - > ul { - padding-left: 0; + ul a[data-current]::before { + left: -2.1rem; } -} - -.o-aside__toc-link { - display: flex; -} -@mixin toc-indicator-nesting { - @for $i from 1 through 4 { - $selector: ""; - @for $j from 1 through $i { - $selector: $selector + "ul "; - } - - #{$selector}a[data-current]:before { - left: calc(-#{$i - 1}em - 2.1rem); - } + ul ul a[data-current]::before { + left: calc(-1em - 2.1rem); } -} -.o-aside__toc { a[data-current] { font-weight: bold; position: relative; @@ -93,7 +78,13 @@ } } - @include toc-indicator-nesting; + > ul { + padding-left: 0; + } +} + +.o-aside__toc-link { + display: flex; } .o-related { @@ -159,8 +150,6 @@ background: var(--bg-default); overflow-y: scroll; overscroll-behavior-y: contain; - border-left: var(--border); - border-right: var(--border); .o-single__container { border: none; @@ -177,8 +166,10 @@ flex-direction: column; gap: 1.5rem; width: 100%; - border: var(--border); + border-top: var(--border); border-bottom: 1px solid #3d444d; + border-left: none; + border-right: none; padding: 1rem; height: 6.4rem; border-radius: 1rem 1rem 0 0;