Layout
Returns the layout for the given page as defined in front matter.
Syntax
PAGE.Layout
Returns
string
Specify the layout field in front matter to target a particular template. See details.
---
layout: contact
title: Contact
---+++
layout = 'contact'
title = 'Contact'
+++{
"layout": "contact",
"title": "Contact"
}
Hugo will render the page using contact.html.
layouts/
├── baseof.html
├── contact.html
├── home.html
├── page.html
├── section.html
├── taxonomy.html
└── term.htmlAlthough rarely used within a template, you can access the value with:
{{ .Layout }}The Layout method returns an empty string if the layout field in front matter is not defined.
Last updated:
June 18, 2026
:
Merge commit 'c86d9f4aa8a58931f52df6516f10b67c807505fb' (be780afa7)
Improve this page