feat(page): support preview_only in combination with header image

Enables use of featured image for thumbnails only with a full-width
header image `[header]` shown on the page itself.

See https://github.com/gcushen/hugo-academic/issues/728#issuecomment-436225586
See https://sourcethemes.com/academic/docs/managing-content/#featured-image
See #728
This commit is contained in:
George Cushen committed 2018-11-10 17:42:12 +00:00
1 parent 3b4616e357
commit 68166bac4a
1 file changed
+2 -2
+2 -2
View File
@@ -15,7 +15,7 @@
{{end}}
{{/* Header image */}}
{{ if and .Params.header.image (not $featured) }}
{{ if and .Params.header.image (not (and $featured (not .Params.image.preview_only))) }}
<div class="article-header">
{{ $img_src := urls.Parse .Params.header.image }}
{{ if $img_src.Scheme }}
@@ -29,7 +29,7 @@
{{end}}
{{/* Featured image */}}
{{ if and $featured (not $.Params.image.preview_only) }}
{{ if and $featured (not .Params.image.preview_only) }}
{{ $image := $featured.Fill (printf "1600x400 q90 %s" $anchor) }}
<div class="article-header d-xl-none">
<img src="{{ $image.RelPermalink }}" class="article-banner" itemprop="image" alt="">