Skip to content

Commit

Permalink
feat: add the sidebar.position parameter (#545)
Browse files Browse the repository at this point in the history
When end, place the sidebar on the right.
  • Loading branch information
razonyang committed Dec 14, 2023
1 parent 42fed95 commit 2639b86
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
16 changes: 13 additions & 3 deletions assets/hb/modules/blog/scss/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,22 @@
@include media-breakpoint-up(lg) {
display: grid;
grid-gap: 1rem;
grid-template-areas: "sidebar main";
grid-template-columns: 2fr minmax(0, 5fr);

@if $hb-blog-sidebar-position == end {
grid-template-areas: "main sidebar";
grid-template-columns: minmax(0, 5fr) 2fr;
} @else {
grid-template-areas: "sidebar main";
grid-template-columns: 2fr minmax(0, 5fr);
}
}

@include media-breakpoint-up(xl) {
grid-template-columns: 2fr minmax(0, 7fr);
@if $hb-blog-sidebar-position == end {
grid-template-columns: minmax(0, 7fr) 2fr;
} @else {
grid-template-columns: 2fr minmax(0, 7fr);
}
}
}

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
@@ -1,3 +1,4 @@
{{- $hasSidebar := partialCached "hb/modules/blog/functions/has-sidebar" . }}
$hb-blog-sidebar: {{ $hasSidebar }};
$hb-blog-sidebar-position: {{ default "start" site.Params.hb.blog.sidebar.position }};
$hb-blog-home-pinned-posts-pos: '{{ default "" site.Params.hb.blog.home.pinned_posts_position }}';
3 changes: 3 additions & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ paginate = 30
[params.hb.blog.home]
pinned_posts_position = ""
# taxonomies_style = 'toggle'

[params.hb.blog.sidebar]
position = "start"

0 comments on commit 2639b86

Please sign in to comment.