summaryrefslogtreecommitdiffstats
path: root/docs/content/en/functions/global/site.md
blob: a4879fee0186d191326e07dadcfae575a789ccf0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
---
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]
---

Use the `site` function to return the `Site` object regardless of current context.

```go-html-template
{{ site.Params.foo }}
```

When the `Site` object is in context you can use the `Site` property:

```go-html-template
<!-- current context -->
{{ .Site.Params.foo }}
<!-- template context -->
{{ $.Site.Params.foo }}
```

{{% note %}}
To simplify your templates, use the global `site` function regardless of whether the `Site` object is in context.
{{% /note %}}