Written by
Edd Turtle
on makewithhugo.com
on
on
Check If a Page Is the Home Page
When writing and changing Hugo templates you will often want to act differently based on whether the page you are looking at is the home page, or any other page. So the post pages, contact, about etc won’t have this content show.
Likewise the reverse is also useful - only show something on the home page. Both of these scenarios are possible through using IF statements in your templates.
On Home Page Only
|
|
Every page except Home Page
For the reverse we have use the ne command and check it against our bool value.
|
|
Site illustrations (of Hugo the rabbit) drawn by Carina Roberts.