How to access home page params from any context


I am trying to get the home page .Params.image url when I am on a page other than the home page.


style="background-image: url('{{ .Site.Home.Params.image }}')" does not work.


It would help to see your code as there are lots of different causes for this issue, and we want to help :slightly_smiling_face:

The ‘home page parameters’ are they set in config.toml or in the front matter of a markdown file?


@funkydan2, here is the template I am using:

Within jumbotron.html, I am looking to replace:

<div class="pv5 pv6-l ph3 bg-center cover" style="background-image: url('{{.imageUrl}}')">


<div class="pt3 h5 cover bg-bottom-right" style="background-image: url('{{ .Site.Home.Params.image }}')">

The home page parameters are set in a mark down file in site/content/values


I fixed this by setting a variable imageUrl to be .Site.Home.Params.image and then updating my code to:

style="background-image: url('{{ .imageUrl }}')"