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..3d2bf6ee 100644 --- a/layouts/partials/hb/modules/blog/post/card.html +++ b/layouts/partials/hb/modules/blog/post/card.html @@ -11,64 +11,80 @@ {{- $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 $meta (ne $pageMeta false) }} -
- {{- if default true $pageMeta.authors }} - {{ partialCached "hb/modules/blog/post/meta/authors" $page $page }} - {{- end }} - {{- if default true $pageMeta.date }} - {{ partialCached "hb/modules/blog/post/meta/date" $page $page }} - {{- end }} - {{- if and $readingTime (default true $pageMeta.reading_time) }} - {{ partialCached "hb/modules/blog/post/meta/reading-time" $page $page }} - {{- end }} - {{ partialCached "hb/modules/blog/post/meta/first-section" $page $page }} -
- {{- end }} - {{- if default true site.Params.hb.blog.post_thumbnail }} - {{ partial "hb/modules/blog/post/card-img" $page }} + {{- if and $thumbnail (ne $thumbnailPos "top") }} + {{ printf `
` | safeHTML }} +
+ {{ partial "hb/modules/blog/post/card-img" $page }} +
{{- end }} -
-
- - {{- if $page.Params.pinned }} - {{- partialCached "hb/modules/blog/helpers/pinned-icon" . -}} +
+ {{- if and $meta (ne $pageMeta false) }} + - {{- if and $meta (ne $pageMeta false) (default true $pageMeta.taxonomies) }} - {{- end }} - {{- if $showSummary }} - {{- $summary := $page.Summary }} - {{- $truncated := $page.Truncated }} - {{- with $page.Description }} - {{- $summary = . }} - {{- $truncated := true }} - {{- end }} -
- {{- $summary -}} + {{- if and $thumbnail (eq $thumbnailPos "top") }} + {{ partial "hb/modules/blog/post/card-img" $page }} + {{- end }} +
+
+ + {{- if $page.Params.pinned }} + {{- partialCached "hb/modules/blog/helpers/pinned-icon" . -}} + {{- end }} + {{- $page.Title -}} + {{- if $external }} + {{- partial "icons/icon" (dict "vendor" "bootstrap" "name" "box-arrow-up-right" "className" "ms-1") }} + {{- end }} +
- {{- if and $readMore $truncated }} -
- - {{- i18n "read_more_about" $page.Title -}} - + {{- if and $meta (ne $pageMeta false) (default true $pageMeta.taxonomies) }} + {{- end }} - {{- end }} + {{- if $showSummary }} + {{- $summary := $page.Summary }} + {{- $truncated := $page.Truncated }} + {{- with $page.Description }} + {{- $summary = . }} + {{- $truncated := true }} + {{- end }} +
+ {{- $summary -}} +
+ {{- if and $readMore $truncated }} + + {{- 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 }}