Using global site param as shortcode parameter

Hi, I made a small shortcode to use external links inside my content markdown files:

<a href="{{ index .Params 0 }}" target="_blank">{{ index .Params 1 }}</a>

It works and outputs fine if I give it typed values:

{{% external-link mylink mytext %}}

But is it possible to use values from my site’s config.toml file? In there, I have:

[params]
  Somelink = "https://somelink.com"

I want to do something like:

{{% external-link .Site.Params.Somelink mytext %}}

But it just outputs the shortcode text itself.

The curly brackets, {{ }}, are have you call the shortcode in the content. You want the parameter to be in the shortcode template, using $.Page.Site.Params.

1 Like

So you mean, call $.Page.Site.Params from inside the shortcode? But I want to define that parameter when I call the shortcode, not have it defined once from inside its template. So it would be possible to call it both with a site param, or a string.