mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-25 22:00:58 +02:00
Merge commit 'e509cac533600cf4fa8382c9cdab78ddd82db688'
This commit is contained in:
35
docs/content/en/functions/site/index.md
Normal file
35
docs/content/en/functions/site/index.md
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
title: site
|
||||
description: Provides global access to the .Site object.
|
||||
categories: [functions]
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: functions
|
||||
function:
|
||||
aliases: []
|
||||
returnType:
|
||||
signatures: [site]
|
||||
relatedFunctions:
|
||||
- hugo
|
||||
- page
|
||||
- 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 %}}
|
Reference in New Issue
Block a user