Update og:video code

This commit is contained in:
BBaoVanC 2021-10-09 18:31:05 -05:00
parent b2a5a6acaf
commit 3242d892b5
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A

View File

@ -27,15 +27,15 @@
{{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }} {{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }}
{{- with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }} {{- with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }}
{{- with .Params.videos -}}
{{- range first 6 . }}<meta property="og:video" content="{{ . | absURL }}" />{{ end -}}
{{- else -}}
{{- $videos := $.Resources.ByType "video" -}} {{- $videos := $.Resources.ByType "video" -}}
{{- $featured_video := $videos.GetMatch "*feature*" -}} {{- $featured_video := $videos.GetMatch "*feature*" -}}
{{- if not $featured_video }}{{ $featured_video = $videos.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} {{- if not $featured_video }}{{ $featured_video = $videos.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured_video -}} {{- with $featured_video -}}
<meta property="og:video" content="{{ $featured_video.Permalink | absURL }}" /> <meta property="og:video" content="{{ $featured_video.Permalink | absURL }}" />
{{- else -}} {{- end -}}
{{- with .Params.videos }}{{- range . }}
<meta property="og:video" content="{{ . | absURL }}" />
{{ end }}{{ end }}
{{- end -}} {{- end -}}
{{- /* If it is part of a series, link to related articles */}} {{- /* If it is part of a series, link to related articles */}}