Accessing page resources by name?

Ooooh yes because the . is the range context. I totally missed that. I need to put in some time to learn Go properly.

For anyone who has a similar problem here’s my complete working solution:

{{ with .Site.GetPage "accreditations/index.md" }}
{{ $resources := .Resources }}
<div class="uk-section">
  <h2>{{ .Title }}</h2>
  {{ with .Content }}
  <p class="summary">{{- . -}}</p>
  {{ end }}

  <ul class="uk-grid-small uk-child-width-expand@s uk-text-center" uk-grid>
    {{ range .Params.accreditations }}
    <li>
      {{ with $resources.GetMatch (.image) }}
      <img src="{{ .Permalink }}">
      {{ end }}
      <h3>{{ .title }}</h3>
      <p>{{ .number }}</p>
    </li>
    {{ end }}
  </ul>
</div>
{{ end }}
1 Like