Home
返回给定站点的主页页面对象。
Syntax
SITE.Home
Returns
page.Page
Site 对象上的 Home 方法是访问主页的便捷方式,功能上等同于:
{{ .Site.GetPage "/" }}因为它返回 Page 对象,您可以通过 链接 使用任何可用的 页面方法。例如:
{{ .Site.Home.Store.Set "greeting" "Hello" }}此方法通常用于生成指向主页的链接。例如:
站点配置:
baseURL: https://example.org/docs/
baseURL = 'https://example.org/docs/'
{
"baseURL": "https://example.org/docs/"
}
模板:
{{ .Site.Home.Permalink }} → https://example.org/docs/
{{ .Site.Home.RelPermalink }} → /docs/