Declare sitewide variable to access in themes?

I want to be able to declare a (kind of a) global variable, which can hold base url of my website, and then have all of my content pages have it prepended to a URL that I want to print.

I tried declaring one in config.toml and tried accessing it in my theme’s baseof.html, but nothing apart from menu entries were accessible.

Is something like possible?

I think I got it.
You can create your own variables like:

[params.<section>]
 <arg> = <value>

and access them with {{ .Site.Params.<section>.<arg> }} in your template.

Example :

Custom variables need to be defined as a param. For example:

[params]
  my_global = "foo"

Then access it in templates like:

{{ site.Params.my_global }}
1 Like

If it’s specifically that information, it is available as a variable site.BaseURL: Site variables | Hugo

1 Like