Merge branch 'main' into drafts

This commit is contained in:
John Bowdre 2024-02-18 19:59:42 -06:00
commit 9e515a7c19

View file

@ -1,21 +1,13 @@
{{ $base := resources.Get "og_base.png" }} {{ $img := resources.Get "og_base.png" }}
{{ $font := resources.Get "/FiraMono-Regular.ttf" }} {{ $font := resources.Get "/FiraMono-Regular.ttf" }}
{{ $text := "" }}
<meta property="og:title" content="{{ .Title }}" /> <meta property="og:title" content="{{ .Title }}" />
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" /> <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" /> <meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" /> <meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:locale" content="{{ .Lang }}" /> <meta property="og:locale" content="{{ .Lang }}" />
{{- if .IsHome }} {{- if .IsHome }}
{{ $img := $base.Filter (images.Text .Site.Params.Description (dict {{ $text = .Site.Params.Description }}
"color" "#d8d8d8"
"size" 64
"linespacing" 2
"x" 40
"y" 300
"font" $font
))}}
{{ $img = resources.Copy "og.png" $img }}
{{ .Scratch.Set "og_image" $img }}
{{- end }} {{- end }}
{{- if .IsPage }} {{- if .IsPage }}
@ -23,12 +15,15 @@
<meta property="article:section" content="{{ .Section }}" /> <meta property="article:section" content="{{ .Section }}" />
{{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }} {{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
{{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }} {{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
{{ with .Params.thumbnail }} {{ $text = .Page.Title }}
{{/* $thumbPath := (add $.Page.RelPermalink . ) */}} {{ end }}
{{- with .Params.thumbnail }}
{{ $thumbnail := $.Resources.Get . }} {{ $thumbnail := $.Resources.Get . }}
{{ with $thumbnail }} {{ with $thumbnail }}
{{ $img := $base.Filter (images.Overlay (.Process "fit 300x250") 875 38 )}} {{ $img = $img.Filter (images.Overlay (.Process "fit 300x250") 875 38 )}}
{{ $img = $img.Filter (images.Text $.Page.Title (dict {{ end }}{{ end }}
{{ $img = $img.Filter (images.Text $text (dict
"color" "#d8d8d8" "color" "#d8d8d8"
"size" 64 "size" 64
"linespacing" 2 "linespacing" 2
@ -37,22 +32,6 @@
"font" $font "font" $font
))}} ))}}
{{ $img = resources.Copy (path.Join $.Page.RelPermalink "og.png") $img }} {{ $img = resources.Copy (path.Join $.Page.RelPermalink "og.png") $img }}
{{ $.Scratch.Set "og_image" $img }}
{{ end }}
{{ else }}
{{ $img := $base.Filter (images.Text .Page.Title (dict
"color" "#d8d8d8"
"size" 64
"linespacing" 2
"x" 40
"y" 300
"font" $font
))}}
{{ $img = resources.Copy (path.Join $.Page.RelPermalink "og.png") $img }}
{{ .Scratch.Set "og_image" $img }}
{{ end }}
{{- end -}}
{{ $img := .Scratch.Get "og_image" }}
<meta property="og:image" content="{{$img.Permalink}}"> <meta property="og:image" content="{{$img.Permalink}}">
<meta property="og:image:width" content="{{$img.Width}}" /> <meta property="og:image:width" content="{{$img.Width}}" />