| 1 |
--- |
| 2 |
title: site |
| 3 |
description: Returns the Site object of the current site, accessible from any context. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
aliases: [] |
| 9 |
returnType: page.siteWrapper |
| 10 |
signatures: [site] |
| 11 |
aliases: [/functions/site] |
| 12 |
--- |
| 13 |
|
| 14 |
Use the `site` function to return the `Site` object regardless of current context. |
| 15 |
|
| 16 |
```go-html-template |
| 17 |
{{ site.Params.foo }} |
| 18 |
``` |
| 19 |
|
| 20 |
When the `Site` object is in context you can use the `Site` property: |
| 21 |
|
| 22 |
```go-html-template |
| 23 |
<!-- current context --> |
| 24 |
{{ .Site.Params.foo }} |
| 25 |
<!-- template context --> |
| 26 |
{{ $.Site.Params.foo }} |
| 27 |
``` |
| 28 |
|
| 29 |
> [!NOTE] |
| 30 |
> To simplify your templates, use the global `site` function regardless of whether the `Site` object is in context. |