Thanks a lot @jmooring
For anyone else stumbling upon this page; the solution would be something like this:
{{ if eq .Kind "home" }}
.....whatever you want to do as per the home page......
{{ else }}
......something else you want to do on other pages.....
{{ end }}
Alternatively, you can also do it section-wise:
{{ if eq .Section "whatever-is-your-section" }}
Another way, both my index.html
and list.html
were calling post-list.html
file.
You can also create a home-post-list.html
file that caters to index.html
whereas the post-list.html
file caters to list.html
(sections for example).
Reference to Page Kinds:
https://gohugo.io/templates/section-templates/#page-kinds
Other references:
https://discourse.gohugo.io/t/how-to-check-for-home-page/149/25?u=ansin218