Skip to content

Commit

Permalink
feat(article-cards): add the imgHeight parameter
Browse files Browse the repository at this point in the history
style: change the image height as 120px by default
  • Loading branch information
razonyang committed Sep 19, 2023
1 parent 7afc9ac commit d66590c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions layouts/partials/bootstrap/article-cards.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
{{- $sections := slice }}
{{- $linkText := i18n "read_more" }}
{{- $itemAttrs := slice }}
{{- $imgHeight := 120 }}
{{- if .IsNamedParams }}
{{- with .Get "limit" }}{{ $limit = . }}{{ end }}
{{- with .Get "summaryLen" }}{{ $summaryLen = . }}{{ end }}
{{- with .Get "sections" }}{{ $sections = split . "," }}{{ end }}
{{- if isset .Params "linkText" }}{{ $linkText = .Get "linkText" }}{{ end }}
{{- $itemAttrs = partial "bootstrap/functions/attributes" (dict "Params" .Params "Prefix" "item-attr") }}
{{- with .Get "imgHeight" }}{{ $imgHeight = . }}{{ end }}
{{- end }}
{{- $pages := site.RegularPages }}
{{- with $sections }}
Expand Down Expand Up @@ -38,14 +40,14 @@
"Page" .
"ClassName" "card-img-top object-fit-cover bg-secondary-subtle"
"LazyLoading" false
"Style" (slice "height: 160px;"))
"Style" (slice (printf "height: %dpx;" $imgHeight)))
}}
{{- with $img }}
{{ . }}
{{- else }}
<div
class="bg-secondary-subtle d-flex justify-content-center align-items-center h4 user-select-none my-0"
style="height: 160px; filter: blur(1px);">
style="height: {{ $imgHeight }}px; filter: blur(1px);">
NO IMAGE
</div>
{{- end }}
Expand Down

0 comments on commit d66590c

Please sign in to comment.