Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the sidebar.width parameter, which accepts percentage value… #548

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions assets/hb/modules/blog/scss/_sidebar.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@function hb-blog-sidebar-width-fr($fullWidth) {
@return #{$fullWidth * $hb-blog-sidebar-width}fr;
}

@if $hb-blog-sidebar {
.hb-blog-main-container {
@include media-breakpoint-up(lg) {
Expand All @@ -6,18 +10,18 @@

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

@include media-breakpoint-up(xl) {
@if $hb-blog-sidebar-position == end {
grid-template-columns: minmax(0, 7fr) 2fr;
grid-template-columns: minmax(0, 7fr) hb-blog-sidebar-width-fr(7);
} @else {
grid-template-columns: 2fr minmax(0, 7fr);
grid-template-columns: hb-blog-sidebar-width-fr(7) 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,6 +1,7 @@
{{- $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-sidebar-width: {{ default 0.35 site.Params.hb.blog.sidebar.width }};
$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 @@ -42,6 +42,7 @@ pinned_posts_position = ""

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

[params.hb.blog.toc]
position = "end" # start, end or content.