hugo/content/en/methods/page/Layout.md
Bjørn Erik Pedersen 9b0050e9aa Squashed 'docs/' content from commit 5c085a37b
git-subtree-dir: docs
git-subtree-split: 5c085a37b297bf12f59efeaae591418ec025c10d
2024-01-27 10:48:33 +01:00

902 B

title description categories keywords action
Layout Returns the layout for the given page as defined in front matter.
related returnType signatures
methods/page/Type
string
PAGE.Layout

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

{{< code-toggle file=content/contact.md >}} 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.