Merge commit '8b9803425e63e1b1801f8d5d676e96368d706722'

This commit is contained in:
Bjørn Erik Pedersen
2024-06-21 09:41:24 +02:00
475 changed files with 7408 additions and 4720 deletions

View File

@@ -35,7 +35,7 @@ Do not use the global `page` function in shortcodes, partials called by shortcod
## Explanation
Hugo almost always passes a `Page` as the data context into the top level template (e.g., `single.html`). The one exception is the multihost sitemap template. This means that you can access the current page with the `.` variable in the template.
Hugo almost always passes a `Page` as the data context into the top level template (e.g., `single.html`). The one exception is the multihost sitemap template. This means that you can access the current page with the `.` in the template.
But when you are deeply nested inside of a [content view], [partial], or [render hook], it is not always practical or possible to access the `Page` object.
@@ -101,8 +101,8 @@ When you call the [`Summary`] method, Hugo renders the page content including sh
If Hugo renders the section page before a content page, the cached rendered shortcode will be incorrect. You cannot control the rendering sequence due to concurrency.
[`Summary`]: /methods/page/summary
[`partialCached`]: /functions/partials/includecached
[`Summary`]: /methods/page/summary/
[`partialCached`]: /functions/partials/includecached/
[content view]: /getting-started/glossary/#content-view
[partial]: /getting-started/glossary/#partial
[render hook]: /getting-started/glossary/#render-hook

View File

@@ -12,17 +12,19 @@ action:
aliases: [/functions/site]
---
At the top level of a template that receives the `Site` object in context, these are equivalent:
Use the `site` function to return the `Site` object regardless of current context.
```go-html-template
{{ .Site.Params.foo }}
{{ site.Params.foo }}
```
When the `Site` object is not in context, use the global `site` function:
When the `Site` object is in context you can use the `Site` property:
```go-html-template
{{ site.Params.foo }}
<!-- current context -->
{{ .Site.Params.foo }}
<!-- template context -->
{{ $.Site.Params.foo }}
```
{{% note %}}