Hi there,
In Hugo I can use IsHome
but how can I say if page is not equal to contact then add this partial?
// To be more specific this partial
{{ if not .Params.cta }} {{ partial "components/cta" . }} {{ end }}
Thanks
Hi there,
In Hugo I can use IsHome
but how can I say if page is not equal to contact then add this partial?
// To be more specific this partial
{{ if not .Params.cta }} {{ partial "components/cta" . }} {{ end }}
Thanks
Assuming this content structure…
content/
├── posts/
│ ├── post-1.md
│ └── post-2.md
├── _index.md
└── contact.md
…you can do:
{{ range site.RegularPages }}
{{ if not (.Eq (site.GetPage "/contact")) }}
The current page in the loop is not "contact"
{{ end }}
{{ end }}
…where .Eq
is a method on .Page
to test for equality between pages.