Loop for Micro.blog's special Photos feature

PHOTO EMBED

Thu Mar 18 2021 15:03:29 GMT+0000 (Coordinated Universal Time)

Saved by @cdevroe #html #microblog #hugo

{{ define "main" }}

<!-- HTML for Photos view here -->

                    {{- $list := where .Pages ".Params.photos" "!=" nil -}}
                    {{- $len := (len $list) -}}
                    {{ range $index, $value := $list }}

					<!-- Loop through each post happens here -->
                    <!-- HTML for each item here -->

                                {{ range first 1 .Params.photos }}
									<!-- HTML for the first image here, example given -->
<a href="{{ .Permalink }}" title="{{ .Title }}"><img src="{{ . }}"></img></a>
                                {{ end }}
	
                    {{ end }}
                                      
<!-- More HTML for Photos view -->				
{{ end }}
content_copyCOPY

Micro.blog has a "special" page called Photos. If turned on, the Photos page filters all posts on Micro.blog based on posts that have images in them. Typically, the /photos URL shows those posts and shows them in some form of grid showing the first image linked to the entire post.

http://micro.blog