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

head.html: remove outdated internal template (google analytics v3) #1932

Closed
deining opened this issue Apr 16, 2024 · 7 comments · Fixed by #2006
Closed

head.html: remove outdated internal template (google analytics v3) #1932

deining opened this issue Apr 16, 2024 · 7 comments · Fixed by #2006
Assignees
Milestone

Comments

@deining
Copy link
Collaborator

deining commented Apr 16, 2024

The template head.html still references the internal template for google analytics v3:

{{ if (or $enableGtagForUniversalAnalytics (hasPrefix .Site.Config.Services.GoogleAnalytics.ID "G-")) -}}
{{ template "_internal/google_analytics_gtag.html" . -}}

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.

@deining deining added bug Something isn't working needs-triage labels Apr 16, 2024
@deining deining added this to the 24Q2 milestone Apr 16, 2024
@deining
Copy link
Collaborator Author

deining commented Apr 17, 2024

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.

@jmooring
Copy link

jmooring commented Apr 17, 2024

docsy brings in its own internal template,

It brings its own internal template for google_analytics_gtag, but not for google_analytics_async.html.

image

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:

@marcelbaumann
Copy link

marcelbaumann commented Apr 18, 2024

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.

@onknows
Copy link

onknows commented Apr 19, 2024

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.

@deining
Copy link
Collaborator Author

deining commented Apr 19, 2024

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 dossy, 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.

@huehnerlady
Copy link
Contributor

@deining the URL is now https://raw.githubusercontent.com/deining/docsy/main/layouts/partials/head.html as the pull request has been merged

@chalin chalin added cleanup/refactoring and removed bug Something isn't working needs-triage labels May 16, 2024
@chalin
Copy link
Collaborator

chalin commented May 16, 2024

Btw, Docsy 0.10.0 works with the latest version of Hugo.

The cleanup suggested in the PR will be made later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants