It was helpful to get this response yesterday and now I understand that Page Resources can be called upon even if they aren’t referenced in the frontmatter of the index.md. My next question is relevant if I want to add metadata to the photos I retrieved with resources. In this case I have a gallery parameter where I associate images with descriptions like so:
gallery:
- src: "am-red.JPG"
description: Send it baby
- src: am-kite-sbend.jpg
description: "whatever"
- src: alessio-foil.jpg
description: "gnarly"
But now I just have string returned from “ranging” those gallery images. How do I use that string to return a “resource” which can be resized and such? I’ve tried the following but am receiving errors which are indicating that those methods are not available.
{{ $name := .File.Dir}}
{{ range .Params.gallery }}
{{ $resourceString := (printf "/%s%s" ($name) (.src))}}
{{ $resourceString }}
{{ $img := .Resources.Match $resourceString }}
{{ $img := $img.Resize "x250" }}
<img src="{{ $img.RelPermalink }}" />
<article class="article article-1 bg-image" style="background-image: url('{{ $img.RelPermalink }}');">
<a href="#" target="_blank" class="article-link"></a>
<div class="caption">
<a href="#" class="article-title" target="_blank"><h2>{{ .Parent.Name }}</h2></a>
<div class="entry-meta">
<span class="published">Yesterday</span>
<span class="posted-by">- By <a href="#" title="View all posts by Admin">Admin</a></span>
<span class="posted-in">- in <a href="#" title="View all posts in Holiday">Holiday</a></span>
</div>
</div>
</article>
{{ end }}
Thanks in advance for your time and help!