From 23aaaa19b891cb277c0bf77617f9011e524bd7ec Mon Sep 17 00:00:00 2001 From: Razon Yang Date: Thu, 14 Dec 2023 23:07:27 +0800 Subject: [PATCH] feat: add the sidebar.sticky parameter, to disable sticky behaviour by setting it to false (#549) --- assets/hb/modules/blog/scss/_sidebar.scss | 8 ++++++-- assets/hb/modules/blog/scss/variables.tmpl.scss | 1 + hugo.toml | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/assets/hb/modules/blog/scss/_sidebar.scss b/assets/hb/modules/blog/scss/_sidebar.scss index 6cadd2b7..aef9928a 100644 --- a/assets/hb/modules/blog/scss/_sidebar.scss +++ b/assets/hb/modules/blog/scss/_sidebar.scss @@ -34,10 +34,14 @@ } @include media-breakpoint-up(lg) { - height: calc(100vh - var(--#{$prefix}top-offset)); overflow: auto; - @include top-offset(sticky); + @if $hb-blog-sidebar-sticky { + height: calc(100vh - var(--#{$prefix}top-offset)); + overflow: auto; + + @include top-offset(sticky); + } } .hb-module { diff --git a/assets/hb/modules/blog/scss/variables.tmpl.scss b/assets/hb/modules/blog/scss/variables.tmpl.scss index daee598b..bd51b625 100644 --- a/assets/hb/modules/blog/scss/variables.tmpl.scss +++ b/assets/hb/modules/blog/scss/variables.tmpl.scss @@ -2,6 +2,7 @@ $hb-blog-sidebar: {{ $hasSidebar }}; $hb-blog-sidebar-position: {{ default "start" site.Params.hb.blog.sidebar.position }}; $hb-blog-sidebar-width: {{ default 0.35 site.Params.hb.blog.sidebar.width }}; +$hb-blog-sidebar-sticky: {{ default true site.Params.hb.blog.sidebar.sticky }}; $hb-blog-home-pinned-posts-pos: '{{ default "" site.Params.hb.blog.home.pinned_posts_position }}'; // ToC diff --git a/hugo.toml b/hugo.toml index 285cf8aa..7f2fc693 100644 --- a/hugo.toml +++ b/hugo.toml @@ -43,6 +43,7 @@ pinned_posts_position = "" [params.hb.blog.sidebar] position = "start" width = 0.35 +sticky = true [params.hb.blog.toc] position = "end" # start, end or content.