I’m picking up a resource that is scoped to “featured” images:
{{ with .Resources }}
{{ with .GetMatch "{featured*}" }}
{{ $featured := .Fill "720x450" }}
{{ with $featured }}
<div class="article-thumbnail-wrapper">
<img src="{{ .Permalink }}" alt="{{ $.Title }}" class="article-thumbnail">
</div>
{{ end }}
{{ end }}
{{ end }}
As you can see, the alt text is currently a site param (getting the title of my site). I’d love to be able to use the Title of the article that it is associated with.
I’ve tried adding .Params.Title — which grabes the image name.
I’m not sure what else to try. Any ideas welcome! Thank you
$.Page.Title is what you want to use. Inside of any range or with the dot is what is inside of the range or with, not the “global” context. Common issue
I’d strongly suggest setting an additional parameter for image alt text. Unless the image is an image of the title of the page then setting the title as the alt text is almost certainly incorrect. Generally, alt text should describe the content of the image.