-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add the optional sidebar implementation
- Loading branch information
Showing
13 changed files
with
142 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@if $hb-blog-sidebar { | ||
.hb-blog-main-container { | ||
@include media-breakpoint-up(lg) { | ||
display: grid; | ||
grid-gap: 1rem; | ||
grid-template-areas: "sidebar main"; | ||
grid-template-columns: 1fr 3fr; | ||
} | ||
|
||
@include media-breakpoint-up(xl) { | ||
grid-template-columns: 1fr 4fr; | ||
} | ||
} | ||
|
||
.hb-blog-sidebar { | ||
grid-area: sidebar; | ||
|
||
@include media-breakpoint-up(lg) { | ||
height: calc(100vh - 80px); | ||
overflow: auto; | ||
position: sticky; | ||
top: 80px; | ||
} | ||
} | ||
|
||
.hb-blog-main { | ||
grid-area: main; | ||
overflow: hidden; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.hb-blog-post { | ||
display: grid; | ||
grid-gap: .5rem; | ||
grid-template-areas: | ||
"intro" | ||
"toc" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{{- $hasSidebar := partialCached "hb/modules/blog/functions/has-sidebar" . }} | ||
$hb-blog-sidebar: {{ $hasSidebar }}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{{/* Check whether the sidebar is enabled. */}} | ||
{{- return partialCached "hugopress/functions/has-modules" "hb-blog-sidebar" }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-main-begin" "Page" .) }} | ||
{{ partial "hb/modules/blog/posts" (dict "Pages" .Paginator.Pages) }} | ||
{{ partial "hb/modules/pagination/index" .Paginator }} | ||
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-main-end" "Page" .) }} | ||
<div class="hb-blog-main-container"> | ||
<div class="hb-blog-main"> | ||
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-main-begin" "Page" .) }} | ||
{{- $cols := "row-cols-1 row-cols-md-2" }} | ||
{{- if not (partialCached "hb/modules/blog/functions/has-sidebar" .) }} | ||
{{- $cols = printf "%s row-cols-lg-3" $cols }} | ||
{{- end }} | ||
{{ partial "hb/modules/blog/posts" (dict "Pages" .Paginator.Pages "Cols" $cols) }} | ||
{{ partial "hb/modules/pagination/index" .Paginator }} | ||
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-main-end" "Page" .) }} | ||
</div> | ||
{{ partial "hb/modules/blog/sidebar" . }} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="hb-blog-sidebar pe-lg-1"> | ||
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-sidebar" "Page" .) }} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,37 @@ | ||
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-main-begin" "Page" .) }} | ||
<div class="hb-blog-post hb-module position-relative"> | ||
<div class="hb-blog-post-intro"> | ||
<h1 class="hb-blog-post-title mb-2">{{ .Title }}</h1> | ||
<div class="hb-blog-post-meta mb-2"> | ||
{{ partialCached "hb/modules/blog/post/meta/authors" . . }} | ||
{{ partialCached "hb/modules/blog/post/meta/date" . . }} | ||
{{ partialCached "hb/modules/blog/post/meta/reading-time" . . }} | ||
{{ partialCached "hb/modules/blog/post/meta/taxonomies" . . }} | ||
<div class="hb-blog-main-container"> | ||
<div class="hb-blog-main"> | ||
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-main-begin" "Page" .) }} | ||
<div class="hb-blog-post hb-module position-relative"> | ||
<div class="hb-blog-post-intro"> | ||
<h1 class="hb-blog-post-title mb-2">{{ .Title }}</h1> | ||
<div class="hb-blog-post-meta mb-2"> | ||
{{ partialCached "hb/modules/blog/post/meta/authors" . . }} | ||
{{ partialCached "hb/modules/blog/post/meta/date" . . }} | ||
{{ partialCached "hb/modules/blog/post/meta/reading-time" . . }} | ||
{{ partialCached "hb/modules/blog/post/meta/taxonomies" . . }} | ||
</div> | ||
</div> | ||
<div | ||
class="hb-blog-post-toc mt-2 text-body-secondary position-sticky overflow-y-auto"> | ||
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-toc-begin" "Page" .) }} | ||
{{- partialCached "hb/modules/blog/post/toc" . . }} | ||
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-toc-end" "Page" .) }} | ||
</div> | ||
<div class="hb-blog-post-main"> | ||
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-begin" "Page" .) }} | ||
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-content-begin" "Page" .) }} | ||
{{- $attributes := partial "hugopress/functions/render-attributes" (dict "Page" . "Name" "hb-blog-post-content") }} | ||
<div | ||
class="hb-blog-post-content mb-5" | ||
{{ with $attributes }}{{ . | safeHTMLAttr }}{{ end }}> | ||
{{ .Content }} | ||
</div> | ||
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-content-end" "Page" .) }} | ||
{{- partial "hb/modules/blog/post/comments" . }} | ||
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-end" "Page" .) }} | ||
</div> | ||
</div> | ||
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-main-end" "Page" .) }} | ||
</div> | ||
<div | ||
class="hb-blog-post-toc mt-2 ps-lg-3 text-body-secondary position-sticky overflow-y-auto"> | ||
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-toc-begin" "Page" .) }} | ||
{{- partialCached "hb/modules/blog/post/toc" . . }} | ||
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-toc-end" "Page" .) }} | ||
</div> | ||
<div class="hb-blog-post-main"> | ||
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-begin" "Page" .) }} | ||
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-content-begin" "Page" .) }} | ||
{{- $attributes := partial "hugopress/functions/render-attributes" (dict "Page" . "Name" "hb-blog-post-content") }} | ||
<div class="hb-blog-post-content mb-5"{{ with $attributes }} {{ . | safeHTMLAttr }}{{ end }}> | ||
{{ .Content }} | ||
</div> | ||
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-content-end" "Page" .) }} | ||
{{- partial "hb/modules/blog/post/comments" . }} | ||
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-end" "Page" .) }} | ||
</div> | ||
{{ partial "hb/modules/blog/sidebar" . }} | ||
</div> | ||
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-main-end" "Page" .) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters