Desired Behavior:
I am trying to set a condition that determines which partial is called based on whether the context is the home page or not.
Current Behavior:
I have an index page where I declare a variable based on whether the context .isHome
or not.
Problem:
However, I have not successfully been able to get .IsHome to evaluate to True, nor have I been able to pass $setJumbotronOverlay as a variable to partial Jumbotron.
My code is below…
My index.html:
{{ define "main" }}
<!-- create variable to submit to jumbotron -->
{{ $setJumbotronOverlay := "false" }}
{{ if .IsHome }}
{{ $setJumbotronOverlay := "true" }}
{{ end }}
{{ partial "jumbotron" (dict "imageUrl" .Params.image "title" .Title "setJumbotronOverlay" $setJumbotronOverlay "content" .) }}
{{ partial "blog" . }}
{{ end }}
My jumbotron.html Partial
<div class="pt3 h5 cover bg-bottom-right" style="background-image: url('{{ .imageUrl }}')">
{{ if .set_jumbotron_overlay . }}
<div class="fl relative_center" style="background-color:white;width:800px;min-height: 500px">
{{ partial "for_home" . }}
<!-- all other pages -->
{{ else }}
{{ partial "different_page" }}
{{ end }} <!-- end if statement determining content based on page url -->
</div>
Is there an obvious mistake that I am making in using if statements, .isHome, or passing variables?
Also, if anyone has a better suggestion for achieving my end goal, I would appreciate some advice.