23 lines
No EOL
950 B
HTML
23 lines
No EOL
950 B
HTML
{{/* Generate opengraph image */}}
|
|
{{ $base := resources.Get "og_base.png" }}
|
|
{{ $mediumFont := resources.Get "fonts/JetBrainsMono-Medium.ttf" }}
|
|
{{ $img := $base.Filter (images.Text .Title (dict
|
|
"color" "#ffffff"
|
|
"size" 55
|
|
"linespacing" 1
|
|
"x" 141
|
|
"y" 300
|
|
"font" $mediumFont
|
|
))}}
|
|
|
|
{{ $img = resources.Copy (path.Join .Permalink "og.png") $img }}
|
|
<meta property="og:image" content="{{$img.Permalink}}">
|
|
<meta property="og:image:width" content="{{$img.Width}}" />
|
|
<meta property="og:image:height" content="{{$img.Height}}" />
|
|
|
|
<!-- Twitter metadata (used by other websites as well) -->
|
|
<meta name="twitter:card" content="summary_large_image" />
|
|
<meta name="twitter:title" content="{{ .Title }}" />
|
|
<meta name="twitter:description"
|
|
content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}" />
|
|
<meta name="twitter:image" content="{{$img.Permalink}}" /> |