Page Resource Metadata - unexported field


#1

Golang noob, learning by doing but hit a wall. I want to set some page resource params in frontmatter, then use them in a shortcode:

Frontmatter:
!snip!
[[resources]]
name=“RAE415”
src=“RAE415.jpg”
[resources.params]
caption=“Olympia RAE 4/15 (1964)”
+++

(Minimal test) Shortcode:
{{ $res := .Page.Resources.GetMatch (.Get “resname”) }}

{{ $res }}

{{ $res.params.caption }}

Call with: {{% minimaltest resname=“RAE415” %}}

The first two lines of the code seem to work OK and a sensible-looking name is output
Adding the third line gives a failed to render shortcode error:

<$res.params.caption>: params is an unexported field of struct type resource.Resource

I cannot figure out what/where is the mismatch. Tried lots of variations, but clearly there is a gap in my Golang concepts. Very grateful for a codefix or pointer to an explanation of the concept I’m missing.


#2

Try a capital P for Params


#3

Aaaargh!! So close, I trawled the Golang docs, learned about capitalisation and I tried capital C for caption, but somehow did not try capital P for params.

Thanks so much, I really appreciate your help, and the generosity of this community.