7
0
Fork 0
This repository has been archived on 2024-10-15. You can view files and clone it, but cannot push or open issues or pull requests.
fediversity_website_archive/themes/nluug/layouts/partials/opengraph/get-featured-image.html

25 lines
808 B
HTML
Raw Normal View History

{{ $images := $.Resources.ByType "image" }}
{{ $featured := $images.GetMatch "*feature*" }}
{{ if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end }}
{{ if not $featured }}
{{ $featured = resources.Get "/opengraph/background.png" }}
{{ $size := 80 }}
{{ $title := $.LinkTitle }}
{{ if gt (len $title) 20 }}
{{ $size = 70 }}
{{ end }}
{{ $text := $title }}
{{ $textOptions := dict
"color" "#1D3160"
"size" $size
"lineSpacing" 10
"x" 65 "y" 80
"font" (resources.Get "/opengraph/mulish-black.ttf")
}}
{{ $featured = $featured | images.Filter (images.Text $text $textOptions) }}
{{ end }}
{{ return $featured }}