Is it possible to change Page Variables?


I want to change the .Content variable in the baseof.html file so it affects all pages, but the variable seems to be immutable. Is it?

If .Content can’t be changed I will have to do the same change in all single and list.html files. So can it be done?

This request is way to broad, you need to bring a little sample of what you want to achieve. Hugo is a static website generator and all page variables are not changeable but defined by the content of each pages markdown files. If you want to “do something” to the content of ONE page to be shown on ALL pages then you will need to define your own variables.

{{ $myvariable := .Content }}
// do something to it and then print
{{ $myvariable }}

The template documentation for Go is here;

Thanks for your reply!