{{ $w := .w | default 480 }}
{{ $h := .h | default 180 }}
{{ $p := .p }}
{{ $class := .class | default "ml-3" }}
{{ $image := ($p.Resources.ByType "image").GetMatch "**featured*" }}
{{ with $image }}
{{ $image := .Fill (printf "%dx%d" $w $h ) }}
{{ with $image.Params.byline }}
{{ . | html }}
{{ end }}
{{ else }}
{{/* If this is a video page, show a preview image */}}
{{ if $p.Params.youtubeID }}
{{/* If `image` param exists, use that in the card. */}}
{{/* If it doesn't, use the video's medium quality thumbnail if `youtubeID` parameter exists. */}}
{{ $image = cond (isset $p.Params "image") $p.Params.image ($p.Params.youtubeID | printf "https://i.ytimg.com/vi/%s/mqdefault.jpg") }}
{{ with $p.Params.byline }}
{{ . | html }}
{{ end }}
{{ end }}
{{ end }}