Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem using analytics.html and plausible-hugo module #480

Closed
jmb opened this issue Feb 23, 2023 · 2 comments
Closed

Problem using analytics.html and plausible-hugo module #480

jmb opened this issue Feb 23, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@jmb
Copy link

jmb commented Feb 23, 2023

What happened?

As per this issue divinerites/plausible-hugo#17 if I try to use the plausible-hugo module’s partial call {{ partial “plausible_head.html” . }} in congo’s analytics.html file, it doesn’t work. This is because the expected contexts are different.

I don’t know the entire consequences, but changing the call in Congo’shead.html to {{ partial “analytics.html” . }} (where previously .Site was being sent rather than .) fixes the problem.

Is this a change that makes sense? I’m happy to update the default analytics.html and make a PR if it does.

Theme version

v2.5.2

Hugo version

v0.110.0

What browsers are you seeing the problem on?

No response

Relevant Hugo log output

$ hugo
Start building sites … 
hugo v0.110.0-e32a493b7826d02763c3b79623952e625402b168+extended linux/amd64 BuildDate=2023-01-17T12:16:09Z VendorInfo=gohugoio
WARN 2023/02/23 11:40:46 *** Please, consider leaving a star on Github if you like this plausible-hugo module.
 Remove this warning by adding 'gitstar = false' in your plausible config
ERROR 2023/02/23 11:40:46 render of "home" failed: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/jpanther/congo/v2@v2.5.2/layouts/_default/baseof.html:17:6": execute of template failed: template: index.html:17:6: executing "index.html" at <partial "head.html" .>: error calling partial: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/jpanther/congo/v2@v2.5.2/layouts/partials/head.html:109:5": execute of template failed: template: partials/head.html:109:5: executing "partials/head.html" at <partialCached "analytics.html" .Site>: error calling partialCached: "[..]/layouts/partials/analytics.html:1:3": execute of template failed: template: partials/analytics.html:1:3: executing "partials/analytics.html" at <partial "plausible_head.html" .>: error calling partial: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/divinerites/plausible-hugo@v1.17.2/layouts/partials/plausible_head.html:76:19": execute of template failed: template: partials/plausible_head.html:76:19: executing "partials/plausible_head.html" at <.Page.Kind>: can't evaluate field Page in type *hugolib.SiteInfo
ERROR 2023/02/23 11:40:46 render of "section" failed: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/jpanther/congo/v2@v2.5.2/layouts/_default/baseof.html:17:6": execute of template failed: template: _default/list.html:17:6: executing "_default/list.html" at <partial "head.html" .>: error calling partial: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/jpanther/congo/v2@v2.5.2/layouts/partials/head.html:109:5": execute of template failed: template: partials/head.html:109:5: executing "partials/head.html" at <partialCached "analytics.html" .Site>: error calling partialCached: "[..]/layouts/partials/analytics.html:1:3": execute of template failed: template: partials/analytics.html:1:3: executing "partials/analytics.html" at <partial "plausible_head.html" .>: error calling partial: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/divinerites/plausible-hugo@v1.17.2/layouts/partials/plausible_head.html:76:19": execute of template failed: template: partials/plausible_head.html:76:19: executing "partials/plausible_head.html" at <.Page.Kind>: can't evaluate field Page in type *hugolib.SiteInfo
ERROR 2023/02/23 11:40:46 render of "taxonomy" failed: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/jpanther/congo/v2@v2.5.2/layouts/_default/baseof.html:17:6": execute of template failed: template: _default/taxonomy.html:17:6: executing "_default/taxonomy.html" at <partial "head.html" .>: error calling partial: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/jpanther/congo/v2@v2.5.2/layouts/partials/head.html:109:5": execute of template failed: template: partials/head.html:109:5: executing "partials/head.html" at <partialCached "analytics.html" .Site>: error calling partialCached: "[..]/layouts/partials/analytics.html:1:3": execute of template failed: template: partials/analytics.html:1:3: executing "partials/analytics.html" at <partial "plausible_head.html" .>: error calling partial: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/divinerites/plausible-hugo@v1.17.2/layouts/partials/plausible_head.html:76:19": execute of template failed: template: partials/plausible_head.html:76:19: executing "partials/plausible_head.html" at <.Page.Kind>: can't evaluate field Page in type *hugolib.SiteInfo
ERROR 2023/02/23 11:40:46 render of "taxonomy" failed: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/jpanther/congo/v2@v2.5.2/layouts/_default/baseof.html:17:6": execute of template failed: template: _default/taxonomy.html:17:6: executing "_default/taxonomy.html" at <partial "head.html" .>: error calling partial: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/jpanther/congo/v2@v2.5.2/layouts/partials/head.html:109:5": execute of template failed: template: partials/head.html:109:5: executing "partials/head.html" at <partialCached "analytics.html" .Site>: error calling partialCached: "[..]/layouts/partials/analytics.html:1:3": execute of template failed: template: partials/analytics.html:1:3: executing "partials/analytics.html" at <partial "plausible_head.html" .>: error calling partial: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/divinerites/plausible-hugo@v1.17.2/layouts/partials/plausible_head.html:76:19": execute of template failed: template: partials/plausible_head.html:76:19: executing "partials/plausible_head.html" at <.Page.Kind>: can't evaluate field Page in type *hugolib.SiteInfo
Error: Error building site: failed to render pages: render of "page" failed: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/jpanther/congo/v2@v2.5.2/layouts/_default/baseof.html:17:6": execute of template failed: template: _default/single.html:17:6: executing "_default/single.html" at <partial "head.html" .>: error calling partial: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/jpanther/congo/v2@v2.5.2/layouts/partials/head.html:109:5": execute of template failed: template: partials/head.html:109:5: executing "partials/head.html" at <partialCached "analytics.html" .Site>: error calling partialCached: "[..]/layouts/partials/analytics.html:1:3": execute of template failed: template: partials/analytics.html:1:3: executing "partials/analytics.html" at <partial "plausible_head.html" .>: error calling partial: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/divinerites/plausible-hugo@v1.17.2/layouts/partials/plausible_head.html:76:19": execute of template failed: template: partials/plausible_head.html:76:19: executing "partials/plausible_head.html" at <.Page.Kind>: can't evaluate field Page in type *hugolib.SiteInfo
Total in 170 ms
@jpanther
Copy link
Owner

jpanther commented Mar 4, 2023

Thanks for the feedback. The theme caches as many partials as possible for performance reasons but in this case it prevents some of the more advanced analytics that this module is trying to achieve. I'll make the necessary adjustment to prevent the analytics partial being cached which should resolve this issue.

@jmb
Copy link
Author

jmb commented Mar 5, 2023

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants