Can you use the Shortcode param to access site config params?

I recently came across the Shortcode param function, but I don’t quite understand how it works.

According to the docs: “Gets a value from the current Page's params set in front matter, with a fall back to the site param value. It will log an ERROR if the param with the given key could not be found in either.”

With the following front matter in

title = "Example"

I can do {{< param title >}} in and it will give “Example”. This works and makes perfect sense.

I am wondering if param can also be used to get the baseURL from config.toml in since the docs say: with a fall back to the site param value. So if there is no front matter param that matches baseURL it will look for the site param value?

I’ve tried this {{< param baseURL >}} but it doesn’t work. Have I misunderstood the function?

I may be wrong, but I think this shortcode only applies to custom site params, e.g. anything defined under [params] in your config.toml

1 Like

I just tried doing this with a custom site param, and you are correct. It works for that purpose. Thanks.

But if I want to get the baseURL in I’ll need to create a shortcode?

Right. So something like this in your baseurl shortcode

{{ $.Site.BaseURL }}