Skip to content

Commit

Permalink
feat: add the sidebar.sticky parameter, to disable sticky behaviour b…
Browse files Browse the repository at this point in the history
…y setting it to false (#549)
  • Loading branch information
razonyang committed Dec 14, 2023
1 parent 7ba634a commit 23aaaa1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions assets/hb/modules/blog/scss/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions assets/hb/modules/blog/scss/variables.tmpl.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 23aaaa1

Please sign in to comment.