1
0
Fork 0
hugo/docs/content/en/methods/page/Layout.md

904 B

title description categories keywords params
Layout Returns the layout for the given page as defined in front matter.
functions_and_methods
returnType signatures
string
PAGE.Layout

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.

layouts/
└── _default/
    ├── baseof.html
    ├── contact.html
    ├── home.html
    ├── list.html
    └── single.html

Although 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.