user2579277
user2579277

Reputation: 121

In Hugo, how can I set a site constant variables to be used in the content?

I am working on a site which is developed with Hugo.

The problem that I am trying to solve is that I have some string that shows up in many pages on the site, so I want to set it to a global variable. I have started to tackle this with site variables, but I can not get the variable to be used in the content. Is this the way or there is another?

Upvotes: 1

Views: 1057

Answers (1)

user2579277
user2579277

Reputation: 121

After a solution from the Hugo discussion site, you can use site params by adding a new param into the config.toml [params] for example globalString . Then you could reference the global variable like {{< param globalString >}}.

Upvotes: 1

Related Questions