Prechádzať zdrojové kódy

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
George Cushen 6 rokov pred
rodič
commit
68166bac4a
1 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 2 2
      layouts/partials/page_header.html

+ 2 - 2
layouts/partials/page_header.html

@@ -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="">