Describe the bug
When I add in config.toml
googleAnalytics = "UA-hoge"
[privacy]
[privacy.googleAnalytics]
disable = false
anonymizeIP = true
respectDoNotTrack = true
Render error occuered, such as
ERROR 2021/08/15 05:31:06 render of "page" failed: execute of template failed: template: _internal/google_analytics.html:1:16: executing "_internal/google_analytics.html" at <.Site.Config.Privacy.GoogleAnalytics>: can't evaluate field Site in type string
ERROR 2021/08/15 05:31:06 render of "page" failed: execute of template failed: template: _internal/google_analytics.html:1:16: executing "_internal/google_analytics.html" at <.Site.Config.Privacy.GoogleAnalytics>: can't evaluate field Site in type string
ERROR 2021/08/15 05:31:06 render of "page" failed: execute of template failed: template: _internal/google_analytics.html:1:16: executing "_internal/google_analytics.html" at <.Site.Config.Privacy.GoogleAnalytics>: can't evaluate field Site in type string
ERROR 2021/08/15 05:31:06 render of "page" failed: execute of template failed: template: _internal/google_analytics.html:1:16: executing "_internal/google_analytics.html" at <.Site.Config.Privacy.GoogleAnalytics>: can't evaluate field Site in type string
ERROR 2021/08/15 05:31:06 Rebuild failed:
Expected behavior
google analytics(google tagmanagers ) tags displayed in header.
Build Environment
Please try to use Hugo extended version before opening the issue.
Preview Environment
- OS: [macOS]
- Browser [Chrome]
Additional Information
I think With is Rebinds the context (.) , Internal Templates can not use arguments correct config.
inbaseof.html
{{- $analytics := .Site.Config.Privacy.GoogleAnalytics -}}
{{- if not $analytics.Disable }}{{ with .Site.GoogleAnalytics -}}
{{ template "_internal/google_analytics.html" . }}
{{- end -}}{{ end -}}
"_internal/google_analytics.html" arguments were rebinded .Site.GoogleAnalytics by With.
I think this should be fix below.
{{- $analytics := .Site.Config.Privacy.GoogleAnalytics -}}
{{- if not $analytics.Disable }}{{ if .Site.GoogleAnalytics -}}
{{ template "_internal/google_analytics.html" . }}
{{- end -}}{{ end -}}
Describe the bug
When I add in
config.tomlRender error occuered, such as
Expected behavior
google analytics(google tagmanagers ) tags displayed in header.
Build Environment
Please try to use Hugo extended version before opening the issue.
Preview Environment
Additional Information
I think With is Rebinds the context (.) , Internal Templates can not use arguments correct config.
in
baseof.html"_internal/google_analytics.html" arguments were rebinded
.Site.GoogleAnalyticsby With.I think this should be fix below.