I would like to show only the summary and the photos / images of a post on the homepage. How? Is there a Hugo shortcode for fetching at least the first image of a post? I searched quite a few list.html on github, but they use either {{ .Summary }}
or {{ .Content }}
… Any idea?
Looking at @manton’s photo archive page, maybe something like this will point you in the right direction:
{{- $list := where .Site.Pages ".Params.photos" "!=" nil -}}
{{- $len := (len $list) -}}
{{ range $index, $value := $list }}
<div class="photos-grid-item">
<a href="{{ .Permalink }}">
{{ range first 1 .Params.photos }}
<img src="{{ . }}">
{{ end }}
</a>
</div>
{{ end }}
1 Like
This looks too complex for me But I will contemplate this.