I am trying to display an image that is defined in the front matter of a headless page.
The .md file:
---
title: "title"
headless: true
resources :
- src: "/path/to/the/image.png"
name: "authorimage"
title: "title"
---
... content...
The template:
{{ with .Site.GetPage "sitewide/authorfooter.md" }}
<div class="card mb-5">
{{ with (.Resources.GetMatch "authorimage") }}
<figure class="authorimage img-fluid">
<img src="{{ .Permalink }}" style="width:100%;height:auto;" alt="{{ .Title }}" class="card-img-top">
<figcaption>{{ .Title }}</figcaption>
</figure>
{{ end }}
<div class="card-body">
<h3 class="card-title">{{ .Title }}</h3>
<div class="card-text">
{{ .Content }}
</div>
</div>
</div>
{{ end }}
The whole loop {{ with (.Resources.GetMatch "authorimage") }}
is not running (returns nothing).
Could it be that it’s not possible to retrieve resources in headless pages?