refactor: cleanup and unify the featured image metadata integration (#345)
This commit is contained in:
parent
055ab6c4e3
commit
95c38f6193
4 changed files with 54 additions and 67 deletions
12
layouts/partials/utils/featured.html
Normal file
12
layouts/partials/utils/featured.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
{{ $img := "" }}
|
||||
|
||||
{{ with $source := ($.Resources.ByType "image").GetMatch "{*feature*,*cover*,*thumbnail*}" }}
|
||||
{{ $featured := .Fill (printf "1200x630 %s" (default "Smart" .Params.anchor)) }}
|
||||
{{ $img = $featured.Permalink }}
|
||||
{{ else }}
|
||||
{{ with default $.Site.Params.images $.Params.images }}
|
||||
{{ $img = index . 0 | absURL }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ return $img }}
|
Loading…
Add table
Add a link
Reference in a new issue