Using range, first and variable names with front matter arrays

I think I’m missing something subtle (or maybe obvious) about the way arrays defined in front matter work.

I have a page with this data:

   - actiontype: "code"
     name: alice
   - actiontype: "mentor"
     name: bob

and a template that looks like this:

{{ range $action := .Params.Actions }}{{ $action.ActionType }}, {{end}}
{{ range .Params.Actions }}{{ .ActionType }}, {{end}}
{{ range (first 1 .Params.Actions) }}{{ .ActionType }}, {{end}}
{{ range $action2 := (first 1 .Params.Actions) }}{{ $action2.ActionType }}, {{end}}

this is the output I get:

code, mentor,
, ,

but I expected:

code, mentor,
code, mentor,

From reading the docs I kinda expected all of those to work. What am I missing? Thanks!


From the docs:

Page-level .Params are only accessible in lowercase.

So if you try with .actiontype you should see the results you are looking for.

That was it, thanks - I had tried any case and matching the case, but not all lowercase!

The fact that

{{ range $action := .Params.Actions }}{{ $action.ActionType }}, {{end}}

worked kinda made it hard to figure out - based on the docs it shouldn’t in fact have worked ?