docsy
docsy copied to clipboard
head.html: remove outdated internal template (google analytics v3)
The template head.html
still references the internal template for google analytics v3:
https://github.com/google/docsy/blob/b95a4948ee42e601d2685a334e0b2362e31820ef/layouts/partials/head.html#L50-L51
Google Analytics v4 is the current version, and the referenced template is not part of the hugo repo any, as seen here. Therefore this outdated template should be clearly marked as deprecated and eventually removed from the partial.
I just realized that docsy brings in its own internal template for google_analytics_gtag, so the reference in line 51 of the template is valid. However given the fact that support for google analytics v3 will be dropped soon, we should consider emitting a warning here (or deprecating/discarding the template alltogether). The user guide already states a deprecation warning for the use of google analytics v3.
docsy brings in its own internal template,
It brings its own internal template for google_analytics_gtag, but not for google_analytics_async.html.
Hugo began emitting a "google_analytics_async.html" deprecation warning in v0.119.0, released 24 Sep 2023. Hugo removed the template in v0.125.0, released 16 Apr 2024.
Since the release of v0.125.0 we've received two reports of:
Error... error calling partial: execute of template failed: html/template:partials/head.html:53:16: no such template "_internal/google_analytics_async.html"
See also:
I can confirm the problem with hugo v0.125.0-a32400b5f4e704daf7de19f44584baf77a4501ab+extended darwin/arm64 BuildDate=2024-04-16T15:04:41Z VendorInfo=brew
got
render of "page" failed: "/Users/Shared/Projects/tangly-os-site/themes/docsy/layouts/blog/baseof.html:4:7": execute of template failed: template: blog/single.html:4:7: executing "blog/single.html" at <partial "head.html" .>: error calling partial: execute of template failed: html/template:partials/head.html:81:16: no such template "_internal/google_analytics_async.html"
(line numbers are not relevant because I editet the head.html)
Also tested with v0.125.1 and it is not working. Last hugo version with which I could generate my site is 0.124.1.
I also can confirm the problem. I am using hugo snap on Ubuntu 22. I noticed that there is always only latest, there are no older version. Also hugo is default auto-upgrading on Ubuntu 22, this can break stuff without an possibility of performing a downgrade. If an upgrade breaks Hugo, it implies you have to wait for a new release, which is a strange way of doing this.
If an upgrade breaks Hugo, it implies you have to wait for a new release, which is a strange way of doing this.
No. The docsy theme fails with latest Hugo version 0.125.x. This is something that needs to be fixed in docsy, the according PR #1931 exists already. If you don't want to wait, there is a fairly easy workaround. Inside your site's root folder, issue:
mkdir -p layouts/partials
cd layouts/partials
wget https://raw.githubusercontent.com/deining/docsy/deprecation-google-analytics-async/layouts/partials/head.html
If you are on WIndows, you use curl
instead of wget
:
curl -O wget https://raw.githubusercontent.com/deining/docsy/deprecation-google-analytics-async/layouts/partials/head.html
This should fix the issue. Don't forget to remove this downloaded file again once this issue is fixed in the docsy theme and you have upgraded to the next docsy version.
@deining the URL is now https://raw.githubusercontent.com/deining/docsy/main/layouts/partials/head.html
as the pull request has been merged
Btw, Docsy 0.10.0 works with the latest version of Hugo.
The cleanup suggested in the PR will be made later.