Browse Source

Merge c64c8211e2 into 056246eb62

pull/354/merge
Peter Valdemar Mørch 4 years ago
parent
commit
ba9387be9d
No account linked to committer's email address
1 changed files with 11 additions and 3 deletions
  1. 11
    3
      layouts/partials/func/GetFeaturedImage.html

+ 11
- 3
layouts/partials/func/GetFeaturedImage.html View File

@@ -18,13 +18,21 @@
{{/* Declare a new string variable, $linkToCover */}}
{{ $linkToCover := "" }}
{{/* Declare a new string variable, $img, if this is an image resource */}}
{{ $img := "" }}
{{/* Use the value from front matter if present */}}
{{ if .Params.featured_image }}
{{ $linkToCover = .Params.featured_image }}
{{ $img = (.Resources.ByType "image").GetMatch .Params.featured_image }}
{{ if not $img }}
{{ $linkToCover = .Params.featured_image }}
{{ end }}
{{/* Find the first image with 'cover' in the name in this page bundle. */}}
{{ else }}
{{ $img := (.Resources.ByType "image").GetMatch "*cover*" }}
{{ $img = (.Resources.ByType "image").GetMatch "*cover*" }}
{{ end }}
{{ if not $linkToCover }}
{{ with $img }}
{{ $linkToCover = .Permalink }}
{{ end }}

Loading…
Cancel
Save