I am trying to get the home page .Params.image url when I am on a page other than the home page.
Problem:
style="background-image: url('{{ .Site.Home.Params.image }}')" does not work.
I am trying to get the home page .Params.image url when I am on a page other than the home page.
Problem:
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 ![]()
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: https://github.com/netlify-templates/kaldi-hugo-cms-template
Within jumbotron.html, I am looking to replace:
<div class="pv5 pv6-l ph3 bg-center cover" style="background-image: url('{{.imageUrl}}')">
with:
<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 }}')"