Back to Hugo

Layout

docs/content/en/methods/page/Layout.md

0.161.1692 B
Original Source

Specify the layout field in front matter to target a particular template. See details.

{{< code-toggle file=content/contact.md fm=true >}} title = 'Contact' layout = 'contact' {{< /code-toggle >}}

Hugo will render the page using contact.html.

text
layouts/
├── baseof.html
├── contact.html
├── home.html
├── page.html
├── section.html
├── taxonomy.html
└── term.html

Although rarely used within a template, you can access the value with:

go-html-template
{{ .Layout }}

The Layout method returns an empty string if the layout field in front matter is not defined.