HUGO
News Docs Themes Community GitHub

BaseURL

Returns the base URL as defined in the site configuration.

Syntax

SITE.BaseURL

Returns

string

Site configuration:

baseURL: https://example.org/docs/
baseURL = 'https://example.org/docs/'
{
   "baseURL": "https://example.org/docs/"
}

Template:

{{ .Site.BaseURL }} → https://example.org/docs/

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.