| 1 |
--- |
| 2 |
title: Home |
| 3 |
description: Returns the home Page object for the given site. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
returnType: page.Page |
| 9 |
signatures: [SITE.Home] |
| 10 |
--- |
| 11 |
|
| 12 |
The `Home` method on a `Site` object is a convenient way to access the home page, and is functionally equivalent to: |
| 13 |
|
| 14 |
```go-html-template |
| 15 |
{{ .Site.GetPage "/" }} |
| 16 |
``` |
| 17 |
|
| 18 |
Because it returns a `Page` object, you can use any of the available [page methods][] by chaining them. For example: |
| 19 |
|
| 20 |
```go-html-template |
| 21 |
{{ .Site.Home.Store.Set "greeting" "Hello" }} |
| 22 |
``` |
| 23 |
|
| 24 |
This method is commonly used to generate a link to the home page. For example: |
| 25 |
|
| 26 |
Project configuration: |
| 27 |
|
| 28 |
{{< code-toggle file=hugo >}} |
| 29 |
baseURL = 'https://example.org/docs/' |
| 30 |
{{< /code-toggle >}} |
| 31 |
|
| 32 |
Template: |
| 33 |
|
| 34 |
```go-html-template |
| 35 |
{{ .Site.Home.Permalink }} → https://example.org/docs/ |
| 36 |
{{ .Site.Home.RelPermalink }} → /docs/ |
| 37 |
``` |
| 38 |
|
| 39 |
[page methods]: /methods/page/ |