HUGO
Menu
GitHub 87548 stars Mastodon

BaseURL

返回站點配置中定義的基礎 URL。

Syntax

SITE.BaseURL

Returns

string

站點配置:

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

模板:

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

幾乎從來沒有好的理由在模板中使用此方法。由於其用法往往因配置錯誤而脆弱。

請改用 absURLabsLangURLrelURLrelLangURL 函數。


Last updated: January 1, 0001
Improve this page