So I am doing a simple if check on a bool from a struct but it doesn't seem to work, it just stop rendering the HTML.
So the following struct is like this:
type Category struct {
ImageURL string
Title string
Description string
isOrientRight bool
}
Now I have a slice of that Category struct which I get to display with a range.
Bellow is an example of one struct:
juiceCategory := Category{
ImageURL: "lemon.png",
Title: "Juices and Mixes",
Description: `Explore our wide assortment of juices and mixes expected by
today's lemonade stand clientelle. Now featuring a full line of
organic juices that are guaranteed to be obtained from trees that
have never been treated with pesticides or artificial
fertilizers.`,
isOrientRight: true,
}
I've tried multiple ways, like below, but none of them worked:
{{range .Categories}}
{{if .isOrientRight}}
Hello
{{end}}
{{if eq .isOrientRight true}}
Hello
{{end}}
<!-- Print nothing -->
{{ printf .isOrientRight }}
{{end}}