Layout
Returns the layout of the given page as defined in front matter.
- Syntax
- PAGE.Layout
- Returns
- string
Usage
The Layout method on a Page object returns the layout of the given page as defined by the layout field in front matter. If the layout field is not defined, the method returns an empty string.
Set the layout field in front matter to target a specific template. This method is rarely used within a template.
Examples
This example uses this front matter:
---
layout: contact
title: Contact
---+++
layout = 'contact'
title = 'Contact'
+++{
"layout": "contact",
"title": "Contact"
}
{{ .Layout }} → contactLast updated:
November 17, 2026
:
content: Fix fragment lead-ins in examples (4f7c014fa)
Improve this page