diff --git a/themes/lumbung-theme/layouts/partials/pen_card.html b/themes/lumbung-theme/layouts/partials/pen_card.html index cc4f808..1b09857 100644 --- a/themes/lumbung-theme/layouts/partials/pen_card.html +++ b/themes/lumbung-theme/layouts/partials/pen_card.html @@ -5,26 +5,31 @@ {{ $postPermalink := .Permalink}} -

{{ .Title }}

- +

{{ .Title }}

- - {{ with (index (.Resources.ByType "image") 0) }} - {{ $height := add .Height 0.0}} - {{ $ratio := div $height .Width}} - {{ $thumb := .Fit "540x540 q80 webp"}} -
-
- {{ .Title }} -
+ {{$first_image := ""}} + {{$matches := findRESubmatch `]+)(?:'|")` .Content 1 }} + {{range $matches}}{{$first_image = index . 1}}{{end}} + {{with .Resources.Get $first_image}} + {{/* Check for resource type since some TIFFS show up as image, but can not do image operations. Then we can ignore them. */}} + {{if .ResourceType}} + {{ $height := add .Height 0.0}} + {{ $ratio := div $height .Width}} + {{ $thumb := .Fit "540x540 q80 webp"}} +
+
+ {{ .Title }} +
{{ else }}
- {{ end }} + {{ end }} + {{ else }} +
+ {{end}}
{{ .Summary }}
- - -
+ +