<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="{{- .Title -}}" />
{{- $imgurl := "" -}}

{{- if .Params.cover -}}
  {{- $imgurl = .Params.cover -}}
{{- else if .Params.imgs -}}
  {{- $imgurl = index .Params.imgs 0 -}}
{{- end -}}

{{- if gt (len $imgurl) 0 -}}
  {{- $imgurl = lower $imgurl -}}
  {{- if and (not (hasPrefix $imgurl "http://")) (not (hasPrefix $imgurl "https://")) -}}
    {{- $imgurl = print .Permalink $imgurl -}}
  {{- end -}}
<meta name="twitter:image" content="{{- $imgurl -}}" />
{{- end -}}