[SOLVED] Use value of Page Params to relate to Global Site Param

So, exist a way that the value of a global site params is related with the value of a page params?
I want to have a same partial with dynamic values, in many pages. I want to control these values in one place.

Example:

On the markdown frontmatter:

---
title: "Title of article"
sponsor: name_of_sponsor
---

config.toml

[params]
  [params.sponsor]
    [params.sponsor.name_of_sponsor1]
      active = true
      name = "Name of Sponsor"

    [params.sponsor.name_of_sponsor2]
      active = true
      name = "Other Sponsor"

And in the template (e.g. single.html), something like that:

  Name of Sponsor: {{ .Site.Params.sponsor.{{.Params.sponsor}}.site}}

See https://gohugo.io/functions/index-function/#readout

Name of Sponsor: {{ (index .Site.Params.sponsor .Params.sponsor).name }}
2 Likes

Works like a charm! Thx!

In pages where I needed to list all sponsors, I did:

{{range $sponsor := $.Site.Params.sponsor }}
  {{if $sponsor.active}}
    {{$sponsor.name}}
  {{end}}
{{end}}

Thank you @regis!

2 Likes