不是结构类型 hugolib.SiteInfo 中的字段
is not a field of struct type hugolib.SiteInfo in
我尝试将新的 属性 添加到我的 theme/partials/footer.html
模板,并将 属性 添加到我的 /config.toml
文件,但我不断收到错误消息:
ERROR: 2017/07/09 template: theme/partials/footer.html:16:40: executing "theme/partials/footer.html" at <.Site.CopyrightStart...>: CopyrightStartYear is not a field of struct type *hugolib.SiteInfo in theme/partials/footer.html
我的部分模板文件中的示例:
<span>© {{.Site.copyrightStartYear}}</span>
Hugo 中的模板引擎将查找 config.toml
文件中 [Params]
块下的所有站点参数(在本例中必须是带引号的字符串)。这些可以通过部分模板中的 .Site.Params.<paramName>
查找来引用。
例如
# config.toml
...
[Params]
myParam = "weeee!"
...
并在您的 HTML 片段中使用它:
# somePartial.html
<span>{{ .Site.Params.myParam }}</span>
...
我尝试将新的 属性 添加到我的 theme/partials/footer.html
模板,并将 属性 添加到我的 /config.toml
文件,但我不断收到错误消息:
ERROR: 2017/07/09 template: theme/partials/footer.html:16:40: executing "theme/partials/footer.html" at <.Site.CopyrightStart...>: CopyrightStartYear is not a field of struct type *hugolib.SiteInfo in theme/partials/footer.html
我的部分模板文件中的示例:
<span>© {{.Site.copyrightStartYear}}</span>
Hugo 中的模板引擎将查找 config.toml
文件中 [Params]
块下的所有站点参数(在本例中必须是带引号的字符串)。这些可以通过部分模板中的 .Site.Params.<paramName>
查找来引用。
例如
# config.toml
...
[Params]
myParam = "weeee!"
...
并在您的 HTML 片段中使用它:
# somePartial.html
<span>{{ .Site.Params.myParam }}</span>
...