Fix cover param for og:image

This commit is contained in:
panr 2022-11-06 10:31:25 +01:00
parent 3a101141d0
commit 8b28b06e72

View file

@ -52,8 +52,12 @@
<meta property="og:description" content="{{ if .IsHome }}{{ $.Site.Params.Subtitle }}{{ else if .Description}}{{ .Description | plainify }}{{ else }}{{ .Summary | plainify }}{{ end }}" /> <meta property="og:description" content="{{ if .IsHome }}{{ $.Site.Params.Subtitle }}{{ else if .Description}}{{ .Description | plainify }}{{ else }}{{ .Summary | plainify }}{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" /> <meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:site_name" content="{{ $.Site.Title }}" /> <meta property="og:site_name" content="{{ $.Site.Title }}" />
{{ if and (not .IsHome) (isset .Params "cover") }} {{ if (isset .Params "cover") }}
<meta property="og:image" content="{{ .Param "cover" | absURL }}"> {{ $pageCover := .Param "cover" }}
{{ with (.Resources.GetMatch (.Param "cover")) }}
{{ $pageCover = .RelPermalink }}
{{ end }}
<meta property="og:image" content="{{ $pageCover | absURL }}">
{{ else }} {{ else }}
{{ if isset $.Site.Params "favicon" }} {{ if isset $.Site.Params "favicon" }}
<meta property="og:image" content="{{ $.Site.Params.favicon | absURL }}"> <meta property="og:image" content="{{ $.Site.Params.favicon | absURL }}">
@ -61,8 +65,8 @@
<meta property="og:image" content="{{ printf "img/favicon/%s.png" $.Site.Params.ThemeColor | absURL }}"> <meta property="og:image" content="{{ printf "img/favicon/%s.png" $.Site.Params.ThemeColor | absURL }}">
{{ end }} {{ end }}
{{ end }} {{ end }}
<meta property="og:image:width" content="2048"> <meta property="og:image:width" content="1200">
<meta property="og:image:height" content="1024"> <meta property="og:image:height" content="627">
{{ range .Params.categories }} {{ range .Params.categories }}
<meta property="article:section" content="{{ . }}" /> <meta property="article:section" content="{{ . }}" />
{{ end }} {{ end }}