diff --git a/assets/hb/modules/blog/scss/post/_card.scss b/assets/hb/modules/blog/scss/post/_card.scss index fbc9f087..43c57351 100644 --- a/assets/hb/modules/blog/scss/post/_card.scss +++ b/assets/hb/modules/blog/scss/post/_card.scss @@ -17,3 +17,39 @@ text-transform: uppercase; width: 100%; } + +.hb-blog-post-card-wrapper { + .card-img-top { + border: 0 !important; + display: block; + height: 100%; + margin-top: 0 !important; + } + + .hb-blog-post-card-img { + @extend .rounded-0; + } + + @include media-breakpoint-down(sm) { + .card-img-top { + margin-bottom: .25rem; + } + } + + @include media-breakpoint-up(md) { + .card-img-top { + border-radius: 0 !important; + } + + .hb-blog-post-card-img { + height: 100%; + width: 180px; + } + } + + @include media-breakpoint-up(lg) { + .hb-blog-post-card-img { + width: 240px; + } + } +} diff --git a/hugo.toml b/hugo.toml index d3df9753..0495e25b 100644 --- a/hugo.toml +++ b/hugo.toml @@ -29,6 +29,7 @@ post_date_format = ':date_long' post_thumbnail = true post_thumbnail_placeholder = "" post_thumbnail_default = "images/thumbnail.png" +post_thumbnail_position = "top" list_cols_md = 2 list_cols_lg = 3 # won't work when sidebar was enabled. diff --git a/layouts/partials/hb/modules/blog/index.html b/layouts/partials/hb/modules/blog/index.html index 9ccdf9fa..59b72623 100644 --- a/layouts/partials/hb/modules/blog/index.html +++ b/layouts/partials/hb/modules/blog/index.html @@ -17,7 +17,8 @@ {{- if $hasPinned }}
- {{ partial "hb/modules/blog/posts" (dict "Pages" $pinnedPages "Cols" "row-cols-1" "ReadMore" false) }} + {{- $ctx := dict "Page" (index $pinnedPages 0) "ReadMore" false }} + {{ partial "hb/modules/blog/post/card" $ctx }}
{{- end }} diff --git a/layouts/partials/hb/modules/blog/post/card.html b/layouts/partials/hb/modules/blog/post/card.html index ed48e8b8..742932df 100644 --- a/layouts/partials/hb/modules/blog/post/card.html +++ b/layouts/partials/hb/modules/blog/post/card.html @@ -11,8 +11,20 @@ {{- $meta := default true .Meta }} {{- $pageMeta := default dict $page.Params.meta }} {{- $modularize := default true .Modularize }} +{{- $thumbnail := default true site.Params.hb.blog.post_thumbnail }} +{{- $thumbnailPos := "top" }} +{{- if eq .Caller "list" }} + {{- $thumbnailPos = site.Params.hb.blog.post_thumbnail_position }} +{{- end }}
+ {{- if and $thumbnail (ne $thumbnailPos "top") }} + {{ printf `
` | safeHTML }} +
+ {{ partial "hb/modules/blog/post/card-img" $page }} +
+ {{ printf `
` | safeHTML }} + {{- end }} {{- if and $meta (ne $pageMeta false) }} {{- end }} - {{- if default true site.Params.hb.blog.post_thumbnail }} + {{- if and $thumbnail (eq $thumbnailPos "top") }} {{ partial "hb/modules/blog/post/card-img" $page }} {{- end }}
@@ -71,4 +83,7 @@ {{- end }} {{- end }}
+ {{- if and $thumbnail (ne $thumbnailPos "top") }} + {{ printf `
` | safeHTML }} + {{- end }}
diff --git a/layouts/partials/hb/modules/blog/posts.html b/layouts/partials/hb/modules/blog/posts.html index e7f0142b..a3ed3a53 100644 --- a/layouts/partials/hb/modules/blog/posts.html +++ b/layouts/partials/hb/modules/blog/posts.html @@ -4,7 +4,7 @@
{{ range .Pages }}
- {{- $ctx := dict "Page" . "ReadMore" $readMore "Modularize" $modularize }} + {{- $ctx := dict "Page" . "ReadMore" $readMore "Modularize" $modularize "Caller" "list" }} {{ partial "hb/modules/blog/post/card" $ctx }}
{{ end }}