mirror of
https://github.com/gohugoio/hugo.git
synced 2026-09-02 19:52:38 +00:00
1.1 KiB
1.1 KiB
title, description, categories, keywords, params
| title | description | categories | keywords | params | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Page | Returns the Page object of the given page. |
|
This is a convenience method, useful within partial templates that are called from both shortcode and other template types.
{{ 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.
{{ 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.
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.Titletoo.But don't.