HUGO

Dynamic params in shortcode

Hi,

I have this code in a shortcode:
<p>{{$.Page.Params.first}}</p>
and it is called like:
{{<colorShortCode>}}

How can I make the parameter in the shortcode dynamic so that it will pick up the argument I pass into the shortcode like:
{{<colorShortCode first>}}
so that will render
<p>{{$.Page.Params .Get 0}}</p>

You need to use the index func, e.g.:

{{index .Page.Params (.Get 0) }}
1 Like