diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 833f9239..2640f164 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -65,7 +65,7 @@
{{- $isHidden := (.Param "cover.hiddenInList") | default (.Param "cover.hidden") | default false }} - {{- partial "cover.html" (dict "cxt" . "IsHome" true "isHidden" $isHidden) }} + {{- partial "cover.html" (dict "cxt" . "IsSingle" false "isHidden" $isHidden) }}

{{- .Title }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index ee0fec43..837f6197 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -22,7 +22,7 @@ {{- end }}

{{- $isHidden := (.Param "cover.hiddenInSingle") | default (.Param "cover.hidden") | default false }} - {{- partial "cover.html" (dict "cxt" . "IsHome" false "isHidden" $isHidden) }} + {{- partial "cover.html" (dict "cxt" . "IsSingle" true "isHidden" $isHidden) }} {{- if (.Param "ShowToc") }} {{- partial "toc.html" . }} {{- end }} diff --git a/layouts/partials/cover.html b/layouts/partials/cover.html index 0f8bfbce..e92b5557 100644 --- a/layouts/partials/cover.html +++ b/layouts/partials/cover.html @@ -1,9 +1,10 @@ {{- with .cxt}} {{/* Apply proper context from dict */}} {{- if (and .Params.cover.image (not $.isHidden)) }} {{- $alt := (.Params.cover.alt | default .Params.cover.caption | plainify) }} +{{- $loading := cond $.IsSingle "eager" "lazy" }}
{{- $responsiveImages := (.Params.cover.responsiveImages | default site.Params.cover.responsiveImages) | default true }} - {{- $addLink := (and site.Params.cover.linkFullImages (not $.IsHome)) }} + {{- $addLink := (and site.Params.cover.linkFullImages $.IsSingle) }} {{- $pageBundleCover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} {{- $globalResourcesCover := (resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} {{- $cover := (or $pageBundleCover $globalResourcesCover)}} @@ -17,7 +18,7 @@ {{- end -}} {{- $prod := (hugo.IsProduction | or (eq site.Params.env "production")) }} {{- if (and (in $processableFormats $cover.MediaType.SubType) ($responsiveImages) (eq $prod true)) }} - {{ $alt }} {{- else }}{{/* Unprocessable image or responsive images disabled */}} - {{ $alt }} + {{ $alt }} {{- end }} {{- else }}{{/* For absolute urls and external links, no img processing here */}} {{- if $addLink }}{{ end -}} - {{ $alt }} + {{ $alt }} {{- end }} {{- if $addLink }}{{ end -}} {{/* Display Caption */}} - {{- if not $.IsHome }} + {{- if $.IsSingle }} {{ with .Params.cover.caption }}

{{ . | markdownify }}

{{- end }} {{- end }}