| 1 |
{{ $images := $.Resources.ByType "image" }} |
| 2 |
{{ $featured := $images.GetMatch "*feature*" }} |
| 3 |
{{ if not $featured }} |
| 4 |
{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }} |
| 5 |
{{ end }} |
| 6 |
{{ if not $featured }} |
| 7 |
{{ $featured = resources.Get "/opengraph/gohugoio-card-base-1.png" }} |
| 8 |
{{ $size := 80 }} |
| 9 |
{{ $title := $.LinkTitle }} |
| 10 |
{{ if gt (len $title) 20 }} |
| 11 |
{{ $size = 70 }} |
| 12 |
{{ end }} |
| 13 |
|
| 14 |
{{ $text := $title }} |
| 15 |
{{ $textOptions := dict |
| 16 |
"color" "#FFF" |
| 17 |
"size" $size |
| 18 |
"lineSpacing" 10 |
| 19 |
"x" 65 "y" 80 |
| 20 |
"font" (resources.Get "/opengraph/mulish-black.ttf") |
| 21 |
}} |
| 22 |
|
| 23 |
{{ $featured = $featured | images.Filter (images.Text $text $textOptions) }} |
| 24 |
{{ end }} |
| 25 |
|
| 26 |
{{ return $featured }} |