This repository has been archived on 2024-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
fediversity_website/themes/nluug/layouts/partials/opengraph/get-featured-image.html

25 lines
808 B
HTML
Raw Permalink 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" }}
2024-01-27 16:12:50 +01:00
{{ $size := 60 }}
{{ $title := $.LinkTitle }}
{{ if gt (len $title) 20 }}
2024-01-27 16:12:50 +01:00
{{ $size = 50 }}
{{ end }}
{{ $text := $title }}
2024-01-27 16:12:50 +01:00
{{ $textOptions := dict
2024-03-25 11:21:23 +01:00
"color" "#c9400d"
"size" $size
"lineSpacing" 10
2024-01-27 16:12:50 +01:00
"x" 45 "y" 140
"font" (resources.Get "/opengraph/mulish-black.ttf")
}}
{{ $featured = $featured | images.Filter (images.Text $text $textOptions) }}
{{ end }}
{{ return $featured }}