Back to Hugo

Page

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

0.161.1956 B
Original Source

This is a convenience method, useful within partial templates that are called from both shortcode and other template types.

go-html-template
{{ partial "my-partial.html" . }}

When the shortcode template calls the partial template, it passes the current context (the dot). The context includes identifiers such as Page, Params, Inner, and Name.

go-html-template
{{ partial "my-partial.html" . }}

When the page template calls the partial template, it also passes the current context (the dot). But in this case, the dot is the Page object.

go-html-template
The page title is: {{ .Page.Title }}

To handle both scenarios, the partial template must be able to access the Page object with Page.Page.

[!note] And yes, that means you can do .Page.Page.Page.Page.Title too.

But don't.