Styling with ease with these body classes

<body class="
{{- if .IsHome}}home{{ end -}}
{{- if eq .Kind `page` }}{{ .Section | singularize }}{{ else }}{{ .Section }}{{ end -}}
{{- if and (eq .Type `page`) (ne .IsHome true) }}page{{ end -}}
">

This will result in one of the situations below, which will make styling these pages with CSS a breeze.

<body class="home">
<body class="products">
<body class="product">
<body class="page">

Source: Hugo Codex - Useful body classes

5 Likes