Implement multi-layer fallback

Cover image for anything that's not home (with fallback to favicon where cover is not set), and for anything that is home we use the favicon with fallback to the default color block

Co-Authored-By: Radek Kozieł <radoslaw.koziel@gmail.com>
This commit is contained in:
willstocks 2020-04-03 10:59:22 +01:00 committed by panr
parent a52bef65ce
commit 4ef42a15b2

View File

@ -40,7 +40,15 @@
<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="{{ .Title }}" /> <meta property="og:site_name" content="{{ .Title }}" />
<meta property="og:image" content="{{ if .IsHome }}{{ $.Site.Params.favicon | absURL }}{{else}}{{ isset .Params "cover" | absURL }}{{ end }}"> {{ if and (ne .IsHome) (isset .Params "cover") }}
<meta property="og:image" content="{{ .Param "cover" | absURL }}">
{{ else }}
{{ if isset $.Site.Params "favicon" }}
<meta property="og:image" content="{{ $.Site.Params.favicon | absURL }}">
{{ else }}
<meta property="og:image" content="{{ printf "img/favicon/%s.png" $.Site.Params.ThemeColor | absURL }}">
{{ end }}
{{ end }}
<meta property="og:image:width" content="2048"> <meta property="og:image:width" content="2048">
<meta property="og:image:height" content="1024"> <meta property="og:image:height" content="1024">
{{ range .Params.categories }} {{ range .Params.categories }}