From b9c8a8b30df50afac52b387fbbd3b99dd98e1268 Mon Sep 17 00:00:00 2001 From: alexisben <alex@noesya.coop> Date: Tue, 27 Dec 2022 14:53:24 +0100 Subject: [PATCH] post toc --- assets/sass/_theme/sections/posts.sass | 9 +++++++-- layouts/partials/posts/aside.html | 3 --- layouts/partials/posts/sidebar.html | 14 ++++++++++++++ layouts/posts/single.html | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) delete mode 100644 layouts/partials/posts/aside.html create mode 100644 layouts/partials/posts/sidebar.html diff --git a/assets/sass/_theme/sections/posts.sass b/assets/sass/_theme/sections/posts.sass index 5e4ac43c..09fc6868 100644 --- a/assets/sass/_theme/sections/posts.sass +++ b/assets/sass/_theme/sections/posts.sass @@ -65,7 +65,7 @@ .block-pagination order: 3 @include media-breakpoint-up(desktop) - aside + .post-sidebar @include container-margin-left margin-top: 0 top: 0 @@ -73,8 +73,13 @@ height: 100% position: absolute width: col-outside-container(4) - .post-infos + > div @include sticky($spacing1) + .toc-container + border-top: 1px solid $color-border + padding-top: $spacing1 + position: static + margin-left: 0 // Safe spacing if post is empty .document-content min-height: 350px diff --git a/layouts/partials/posts/aside.html b/layouts/partials/posts/aside.html deleted file mode 100644 index 064fdac8..00000000 --- a/layouts/partials/posts/aside.html +++ /dev/null @@ -1,3 +0,0 @@ -<aside> - {{- partial "posts/post-infos.html" . -}} -</aside> diff --git a/layouts/partials/posts/sidebar.html b/layouts/partials/posts/sidebar.html new file mode 100644 index 00000000..ed2b64ac --- /dev/null +++ b/layouts/partials/posts/sidebar.html @@ -0,0 +1,14 @@ +<div class="post-sidebar"> + <div> + <aside> + {{- partial "posts/post-infos.html" . -}} + </aside> + + {{ partial "toc/container.html" + (dict + "toc" "toc/default.html" + "context" . + ) + }} + </div> +</div> diff --git a/layouts/posts/single.html b/layouts/posts/single.html index f9a1810f..4060e535 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -8,7 +8,7 @@ {{ if .Params.description_short }}<meta itemprop="abstract" content="{{ partial "PrepareHTML" .Params.description_short }}">{{ end }} {{ if .Summary }}<meta itemprop="description" content="{{ partial "PrepareHTML" .Summary }}">{{ end }} - {{ partial "posts/aside.html" . }} + {{ partial "posts/sidebar.html" . }} {{ partial "posts/chapo.html" (dict "context" . -- GitLab