mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-27 21:06:55 +01:00
Allow loading cover from assets folder (#1187)
By default, the cover is loaded from the page resources folder (same folder). If the image is not found, the (global) assets folder is searched as well. If found, the same processing is done. Otherwise, the fallback remains with linking to the image directly.
This commit is contained in:
parent
be5badf317
commit
d6f911cc05
@ -4,7 +4,9 @@
|
||||
<figure class="entry-cover">
|
||||
{{- $responsiveImages := (.Params.cover.responsiveImages | default site.Params.cover.responsiveImages) | default true }}
|
||||
{{- $addLink := (and site.Params.cover.linkFullImages (not $.IsHome)) }}
|
||||
{{- $cover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }}
|
||||
{{- $pageBundleCover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }}
|
||||
{{- $globalResourcesCover := (resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }}
|
||||
{{- $cover := (or $pageBundleCover $globalResourcesCover)}}
|
||||
{{- if $cover -}}{{/* i.e it is present in page bundle */}}
|
||||
{{- if $addLink }}<a href="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" target="_blank"
|
||||
rel="noopener noreferrer">{{ end -}}
|
||||
|
Loading…
Reference in New Issue
Block a user