Curious why all list params in Page are casted as string lists internally, but not in resources.params

As the post title says: Why are the Page.params that are list variables force-casted to string lists? And why isn’t the same done for the same list variables in Page.params.resource.params?

List params in Page

If I have a front-matter like:

+++
title = "Custom front matter with list values in TOML"
tags = ["custom-fm", "list-values"]
draft = false
animals = ["dog", "cat", "penguin", "mountain gorilla"]
strings-symbols = ["abc", "def", "two words"]
integers = [123, -5, 17, 1_234]
floats = [12.3, -5.0, -1.7e-05]
booleans = [true, false]
+++

it looks like Hugo renders those integers, floats, booleans vars as strings internally as seen below:

Hugo output

List params in Page.Resources

But if the exact same parameters are in resources.params, they do not get casted to string:

+++
title = "Custom resource params with list values"
tags = ["resources", "toml"]
draft = false
[[resources]]
  src = "*.png"
  [resources.params]
    booleans = [true, false]
    integers = [123, -5, 17, 1_234]
    animals = ["dog", "cat", "penguin", "mountain gorilla"]
    strings-symbols = ["abc", "def", "two words"]
    floats = [12.3, -5.0, -1.7e-05]
    foo = "bar"
+++

Hugo output


Offshoot post from this other post.

1 Like

It’s legacy reasons.

@spf13 may answer why the original params sices were cast into string slices.