Frontmatter images?

Each of my posts frontmatter contain the following like so:

title: "My Story"
image: "logo.png"

Each of my posts has a folder named ‘images’ alongside it. For example, I have a folder called ‘Blogs’ which contains ‘’ and a folder named ‘images’ which contains ‘logo.png’.

On my homepage (index.html), I have all my posts listed by their urls to access them. Next to these urls I would like each posts ‘logo.png’ to be next to them. Does anyone know how I can go about this?

Any help would be much appreciated. Thanks.

Repo: GitHub - jpnfighter/new-steve

I would organize content into leaf bundles:

├── blogs/
│   ├── blog-1/
│   │   ├──
│   │   └── logo.png
│   └── blog-2/
│       ├──
│       └── logo.png

This way the image is associated with the content, and you don’t need to specify the image in front matter. Your template can then do something like:

{{ range site.RegularPages }}
  <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
  {{ with .Resources.GetMatch "logo.*" }}
    {{ with .Resize "200x" }}
      <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
    {{ end }}
  {{ end }}
{{ end }}

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.