Back to Hugo

Home

docs/content/en/methods/site/Home.md

0.161.1715 B
Original Source

The Home method on a Site object is a convenient way to access the home page, and is functionally equivalent to:

go-html-template
{{ .Site.GetPage "/" }}

Because it returns a Page object, you can use any of the available page methods by chaining them. For example:

go-html-template
{{ .Site.Home.Store.Set "greeting" "Hello" }}

This method is commonly used to generate a link to the home page. For example:

Project configuration:

{{< code-toggle file=hugo >}} baseURL = 'https://example.org/docs/' {{< /code-toggle >}}

Template:

go-html-template
{{ .Site.Home.Permalink }} → https://example.org/docs/ 
{{ .Site.Home.RelPermalink }} → /docs/