Skip to content
This repository has been archived by the owner on Jun 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #128 from willstocks/master
Browse files Browse the repository at this point in the history
Only populate og:image with cover if is set
  • Loading branch information
panr committed Apr 4, 2020
2 parents f8ce76b + cd5a89b commit e70a992
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -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:url" content="{{ .Permalink }}" />
<meta property="og:site_name" content="{{ .Title }}" />
<meta property="og:image" content="{{ if .IsHome }}{{ $.Site.Params.favicon | absURL }}{{else}}{{ .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:height" content="1024">
{{ range .Params.categories }}
Expand Down

0 comments on commit e70a992

Please sign in to comment.