diff --git a/modules/wowchemy/layouts/partials/book_layout.html b/modules/wowchemy/layouts/partials/book_layout.html index ec1c99c5..46c5c9d8 100644 --- a/modules/wowchemy/layouts/partials/book_layout.html +++ b/modules/wowchemy/layouts/partials/book_layout.html @@ -35,26 +35,15 @@ {{/* Cover image */}} - {{ if and .Params.cover.image }} + {{ $cover_image := partial "functions/get_featured_image.html" . }} + {{ if $cover_image }}
- {{- $img := "" -}} - {{ $alt := (.Params.cover.caption | default "") | plainify }} - {{ $destination := .Params.cover.image }} - {{ $is_remote := strings.HasPrefix $destination "http" }} - {{- if not $is_remote -}} - {{- $img = (.Page.Resources.ByType "image").GetMatch $destination -}} - {{- if not $img -}} - {{- $img = resources.Get (path.Join "media" $destination) -}} - {{- end -}} - {{- end -}} - {{ if $img }} - {{ $img = $img.Fit "1800x310 webp" }} - {{$alt}} - {{ else }} - {{$alt}} + {{ $alt := (.Params.image.caption | default "") | plainify }} + {{ $cover_image = $cover_image.Fit "1800x310 webp" }} + {{$alt}} + {{ with (.Params.image.alt_text | default .Params.image.caption) }} + {{ . | markdownify | emojify }} {{ end }} - - {{ with .Params.cover.caption }}{{ . | markdownify | emojify }}{{ end }}
{{end}}