Skip to content

Commit

Permalink
include thumbnails in Open Graph tags
Browse files Browse the repository at this point in the history
  • Loading branch information
stebunovd committed Jan 1, 2025
1 parent 4871b19 commit 0ad7336
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,18 @@
<meta property="og:title" content="{{ .Title }}">
<meta property="og:description" content="{{ .Description }}">
<meta property="og:url" content="{{ .Permalink }}">
{{- $thumbnail := .Resources.GetMatch "thumbnail.png" }}
{{- $thumbnail2x := .Resources.GetMatch "[email protected]" }}
{{- if $thumbnail2x }}
{{- $thumbnail = $thumbnail2x }}}
{{- end }}
{{- if $thumbnail }}
<meta property="og:image" content="{{ $thumbnail.Permalink }}">
<meta name="twitter:image" content="{{ $thumbnail.Permalink }}">
<meta name="twitter:card" content="summary_large_image">
{{- else }}
<meta name="twitter:card" content="summary">
{{- end }}
<meta name="twitter:title" content="{{ .Title }}">
<meta name="twitter:description" content="{{ .Description }}">
<meta name="twitter:url" content="{{ .Permalink }}">
Expand Down

0 comments on commit 0ad7336

Please sign in to comment.