Site variables available to the posts?

Hello community, I am Hugo newcomer from a gitbook camp struggling to understand if Hugo has a similar feature to gitbook’ site variables?

Docs are always talking about templates, but in my case I am rather aiming posts themselves.

To give you an example. Here I am defining in a global site (book) few variables that define different path in the master branch. Later I can use this variables right inside my posts via these shortcodes

**Defined in:** [NuageQos.py][link1]
[link1]: {{ book.gitlab_master_branch }}/{{ book.NuageQoS_path }}

And I am struggling to understand if this is a built-in feature in Hugo, or it should be created via custom shortcode? I would really love to define some variables in the [params] and have them accessible via such shortcode.

Yeah, you can use site variables (including .Site.Params), inside of shortcode templates.

1 Like