hugo/docs/content/en/variables/site.md
Bjørn Erik Pedersen 5fd1e74903
Merge commit '9b0050e9aabe4be65c78ccf292a348f309d50ccd' as 'docs'
```
git subtree add --prefix=docs/ https://github.com/gohugoio/hugoDocs.git master --squash
```

Closes #11925
2024-01-27 10:48:57 +01:00

1.5 KiB

title description categories keywords menu weight toc aliases
Site variables Use these methods with Site objects. A multilingual project will have two or more sites, one for each language.
variables
docs
parent weight
variables 80
80 true
/variables/site-variables/

{{% include "variables/_common/consistent-terminology.md" %}}

All methods

Use any of these methods in your templates.

{{< list-pages-in-section path=/methods/site titlePrefix=.Site. >}}

Multilingual

Use these methods with your multilingual projects.

{{< list-pages-in-section path=/methods/site filter=methods_site_multilingual filterType=include titlePrefix=.Site. omitElementIDs=true >}}

Page collections

Range through these collections when rendering lists on any page.

{{< list-pages-in-section path=/methods/site filter=methods_site_page_collections filterType=include titlePrefix=.Site. omitElementIDs=true >}}

Global site function

Within a partial template, if you did not pass a Page or Site object in context, you cannot use this syntax:

{{ .Site.SomeMethod }}

Instead, use the global site function:

{{ site.SomeMethod }}

{{% note %}} You can use the global site function in all templates to avoid context problems. Its usage is not limited to partial templates. {{% /note %}}