Thumbnail images for / per post in the (posts) list views

Hi Hugo-Users,

I have and idea for a feature I’d like to have / realize: Allowing posts in the list to be showing thumbnail images of embedded images in the posts list view.
That probably eases distinction between different post, but formost is better to look at instead of broken links…

Link to my website repo: strong text

I started out with some code like this ( posts list view of the hugo-book theme) :

{{ define "main" }}

  {{ range sort .Paginator.Pages }}
  <article class="markdown book-post">
    <h2>
      <a href="{{ .RelPermalink }}">{{ partial "docs/title.html" . }}</a>
    </h2>
    {{ partial "docs/post-meta" . }}

    {{ $images := .Resources.ByType "image" }}
    {{ if gt (len $images) 0 }}
      <div class="thumbnails">
        {{ range first 2 $images }}
          {{ $thumb := .Fit "200x200" }}
          <img src="{{ $thumb.RelPermalink }}" alt="Thumbnail for {{ $.Title }}">
        {{ end }}
      </div>
    {{ end }}

    <p>
      {{- .Summary -}}
      {{ if .Truncated }}
        <a href="{{ .RelPermalink }}">...</a>
      {{ end }}
    </p>
  </article>
  {{ end }}

  {{ template "_internal/pagination.html" . }}
{{ end }}

{{ define "toc" }}
  {{ partial "docs/taxonomy" . }}
{{ end }}

You are trying to access the page resources for the post, but the post doesn’t have any page resources due to your file naming.

No:

content/
└── en/
    └── posts/
        └── synth/
            └── 33-simulate-nlc-sloth/
                ├── 33_simulate_nlc_sloth.adoc
                ├── sloth.asc
                ├── sloth_circuit.png
                └── sloth_simulation.png

Yes:

content/
└── en/
    └── posts/
        └── synth/
            └── 33-simulate-nlc-sloth/
                ├── index.adoc
                ├── sloth.asc
                ├── sloth_circuit.png
                └── sloth_simulation.png

Apologies please, I have this fixed in the branch fix/page-bundles.
Do I need to move this / merge this with the main branch?

That depends on the branch from which you are building the site.