summaryrefslogtreecommitdiffstats
path: root/docs/content/en/methods/site/BaseURL.md
blob: ea965a56889f55c299b6a286d81ecc540d459ae7 (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
33
34
35
36
37
---
title: BaseURL
description: Returns the base URL as defined in the site configuration.
categories: []
keywords: []
action:
  related:
    - functions/urls/AbsURL
    - functions/urls/AbsLangURL
    - functions/urls/RelURL
    - functions/urls/RelLangURL
  returnType: string
  signatures: [SITE.BaseURL]
---

Site configuration:

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

Template:

```go-html-template
{{ .Site.BaseURL }} → https://example.org/docs/
```

{{% note %}}
There is almost never a good reason to use this method in your templates. Its usage tends to be fragile due to misconfiguration.

Use the [`absURL`], [`absLangURL`], [`relURL`], or [`relLangURL`] functions instead.

[`absURL`]: /functions/urls/absURL/
[`absLangURL`]: /functions/urls/absLangURL/
[`relURL`]: /functions/urls/relURL/
[`relLangURL`]: /functions/urls/relLangURL/
{{% /note %}}