hugo/content/en/functions/global/site.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

30 lines
668 B
Markdown

---
title: site
description: Provides global access to the current Site object.
categories: []
keywords: []
action:
aliases: []
related:
- functions/global/page
returnType:
signatures: [site]
aliases: [/functions/site]
---
At the top level of a template that receives the `Site` object in context, these are equivalent:
```go-html-template
{{ .Site.Params.foo }}
{{ site.Params.foo }}
```
When the `Site` object is not in context, use the global `site` function:
```go-html-template
{{ site.Params.foo }}
```
{{% note %}}
To simplify your templates, use the global `site` function regardless of whether the `Site` object is in context.
{{% /note %}}