{{- if .Params.cover.image -}}
{{- if (ne $.Params.cover.relative true) }}
{{- else }}
{{- end}}
{{- else }}
{{- with $.Params.images -}}
{{ else -}}
{{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
{{- else -}}
{{- with site.Params.images -}}
{{ else -}}
{{- end -}}
{{- end -}}
{{- end }}
{{- end }}
{{- /* Deprecate site.Social.twitter in favor of site.Params.social.twitter */}}
{{- $twitterSite := "" }}
{{- with site.Params.social }}
  {{- if reflect.IsMap . }}
    {{- $twitterSite = .twitter }}
  {{- end }}
{{- else }}
  {{- with site.Social.twitter }}
    {{- $twitterSite = . }}
    {{- warnf "The social key in site configuration is deprecated. Use params.social.twitter instead." }}
  {{- end }}
{{- end }}
{{- with $twitterSite }}
  {{- $content := . }}
  {{- if not (strings.HasPrefix . "@") }}
    {{- $content = printf "@%v" $twitterSite }}
  {{- end }}
{{- end }}