Thanks alot, @bep. I confirm {{ if .IsHome }}foo{{ end }}
works like a charm after doing a go get
to update Hugo. Much easier!
Hello everybody!
New to Hugo I’ve been trying a whole day to track this down for stripping href from the page title on the root page. Then finally found this thread. Great. .IsHome actually is what I would have expected in the beginning when realizing that .IsNode has a to big scope for this.
I’ll be introducing myself on a later occasion. In short: coming from ikiwiki (a static wiki compiler working with VCS plus a web frontend, great tool, but…) I would like to contribute with about eight years of experience using and templating ikiwiki, regarding the discussion about a web frontend for Hugo.
But first: Thank You for Hugo! It really is a work of love. Still got to wrap my head around a bunch of things, learn necessary bits of Go and more. But even for now it’s amazing.
Best
Boris
To add to this, the above corresponds to:
{{ if eq .Kind "home" }}
In Hugo >= 0.18.
Which is more flexible as you can say:
{{ if eq .Kind "section" }}
{{ if eq .Kind "taxonomy" }}
Etc.
I had to add a section if the page is home and I was adding boolean value under config for that section. Below code did magic for me
{{ if and (eq .Site.Params.HomePageSection true) (.IsHome)}}
{{ partial "home-top-section" }}
{{ end }}
Thanks.