use first image in content as featured image using regex, hugo forum topic 52527
After Width: | Height: | Size: 135 KiB |
After Width: | Height: | Size: 196 KiB |
After Width: | Height: | Size: 199 KiB |
@ -0,0 +1,17 @@
|
||||
---
|
||||
title: "Harvesting: Majelis in Casco Art Institute 15th & 16th March 24"
|
||||
date: "2024-04-18 07:39:51+00:00" #2021-06-10T10:46:33+02:00
|
||||
draft: false
|
||||
summary: ""
|
||||
contributors: ["aline_crater"]
|
||||
original_link: "https://pen.lumbung.space/2024/04/18/harvesting-majelis-in-casco-art-institute-15th-16th-march-24/"
|
||||
feed_name: "pen.lumbung.space"
|
||||
card_type: "pen"
|
||||
sources: ["pen.lumbung.space"]
|
||||
tags: ['majelis', 'documentafifteen', 'lumbung', 'lumbungdotspace', 'lumbungkios']
|
||||
|
||||
---
|
||||
|
||||
<figure class="wp-block-image size-large"><img alt="" class="wp-image-2165" height="724" src="diagrama_2-1024x724.jpg" width="1024"/></figure>
|
||||
<figure class="wp-block-image size-large"><img alt="" class="wp-image-2167" height="724" src="diagrama_3-1024x724.jpg" width="1024"/></figure>
|
||||
<figure class="wp-block-image size-large"><img alt="" class="wp-image-2168" height="724" src="diagrama_1-1-1024x724.jpg" width="1024"/></figure>
|
After Width: | Height: | Size: 415 KiB |
After Width: | Height: | Size: 132 KiB |
After Width: | Height: | Size: 345 KiB |
After Width: | Height: | Size: 251 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 180 KiB |
@ -0,0 +1,20 @@
|
||||
---
|
||||
title: "Harvesting: Majelis in Nieuwe Instituut 8th March 24"
|
||||
date: "2024-03-08 00:08:37+00:00" #2021-06-10T10:46:33+02:00
|
||||
draft: false
|
||||
summary: ""
|
||||
contributors: ["dianoninoo"]
|
||||
original_link: "https://pen.lumbung.space/2024/03/08/harvesting-majelis-in-nieuwe-instituut-8th-march-24/"
|
||||
feed_name: "pen.lumbung.space"
|
||||
card_type: "pen"
|
||||
sources: ["pen.lumbung.space"]
|
||||
tags: ['majelis', 'documentafifteen']
|
||||
|
||||
---
|
||||
|
||||
<figure class="wp-block-image size-large"><img alt="" class="wp-image-2148" height="701" src="1_diana-cantarey_harvesting-rotterdam-1024x701.png" width="1024"/></figure>
|
||||
<figure class="wp-block-image size-large"><img alt="" class="wp-image-2149" height="1024" src="2_diana-cantarey_harvesting-rotterdam-768x1024.png" width="768"/></figure>
|
||||
<figure class="wp-block-image size-large"><img alt="" class="wp-image-2152" height="1024" src="3_diana-cantarey_harvesting-rotterdam-768x1024.png" width="768"/></figure>
|
||||
<figure class="wp-block-image size-large"><img alt="" class="wp-image-2150" height="706" src="4_diana-cantarey_harvesting-rotterdam-1024x706.png" width="1024"/></figure>
|
||||
<figure class="wp-block-image size-large"><img alt="" class="wp-image-2153" height="768" src="5_diana-cantarey_harvesting-rotterdam-1024x768.png" width="1024"/></figure>
|
||||
<figure class="wp-block-image size-large"><img alt="" class="wp-image-2151" height="1024" src="6_diana-cantarey_harvesting-rotterdam-768x1024.png" width="768"/></figure>
|
@ -8,7 +8,7 @@
|
||||
<h2 class="p-name"><a href="{{ .Permalink }}" class="u-url">{{ .Title }}</a></h2>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
{{ with (index (.Resources.ByType "image") 0) }}
|
||||
{{ $height := add .Height 0.0}}
|
||||
{{ $ratio := div $height .Width}}
|
||||
@ -24,7 +24,17 @@
|
||||
{{ .Summary }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<small>this should show the first image in the content</small>
|
||||
{{$first_image := ""}}
|
||||
{{$matches := findRESubmatch `<img\s.*?src=(?:'|")([^'">]+)(?:'|")` .Content 1 }}
|
||||
{{range $matches}}{{$first_image = index . 1}}{{end}}
|
||||
{{with .Resources.Get $first_image}}
|
||||
{{.ResourceType}}
|
||||
{{.MediaType}}
|
||||
<img src="{{ .Permalink }}" alt="">
|
||||
{{/* uncomment below to crash the build*/}}
|
||||
{{/* .Width */}}
|
||||
{{end}}
|
||||
<footer class='post-footer'>
|
||||
<a href="{{ .RelPermalink }}">
|
||||
<svg width="11" height="11" viewBox="0 0 11 11" xmlns="http://www.w3.org/2000/svg">
|
||||
|