mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2025-08-11 01:31:37 -05:00
Support opengraph structured properties on image and video
This commit is contained in:
@@ -3,16 +3,6 @@
|
||||
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}">
|
||||
<meta property="og:url" content="{{ .Permalink }}">
|
||||
|
||||
{{ $images := $.Resources.ByType "image" }}
|
||||
{{ $featured := $images.GetMatch "*feature*" }}
|
||||
{{ if not $featured }}
|
||||
{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}
|
||||
{{ end }}
|
||||
|
||||
{{ with $featured }}
|
||||
<meta property="og:image" content="{{ $featured.Permalink }}">
|
||||
{{ end }}
|
||||
|
||||
{{ with .Section }}
|
||||
<meta property="article:section" content="{{ . }}">
|
||||
{{ end }}
|
||||
@@ -37,12 +27,38 @@
|
||||
<meta property="og:site_name" content="{{ . }}">
|
||||
{{ end }}
|
||||
|
||||
{{ $images := $.Resources.ByType "image" }}
|
||||
{{ $featured := $images.GetMatch "*feature*" }}
|
||||
{{ if not $featured }}
|
||||
{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}
|
||||
{{ end }}
|
||||
|
||||
{{ with $featured }}
|
||||
<meta property="og:image" content="{{ $featured.Permalink }}">
|
||||
{{ with .Params.alt }}
|
||||
<meta property="og:image:alt" content="{{ . }}">
|
||||
{{ end }}
|
||||
{{ with .MediaType }}
|
||||
<meta property="og:image:type" content="{{ . }}">
|
||||
{{ end }}
|
||||
{{ with .Width }}
|
||||
<meta property="og:image:width" content="{{ . }}">
|
||||
{{ end }}
|
||||
{{ with .Height }}
|
||||
<meta property="og:image:height" content="{{ . }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $videos := $.Resources.ByType "video" }}
|
||||
{{ $featured_video := $videos.GetMatch "*feature*" }}
|
||||
{{ if not $featured_video }}
|
||||
{{ $featured_video = $videos.GetMatch "{*cover*,*thumbnail*}" }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{ with $featured_video }}
|
||||
<meta property="og:video" content="{{ $featured_video.Permalink | absURL }}">
|
||||
{{ with .MediaType }}
|
||||
<meta property="og:video:type" content="{{ . }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
Reference in New Issue
Block a user