-
Notifications
You must be signed in to change notification settings - Fork 283
Description
I confirm:
- I am running the extended version of Hugo version 0.91.0 or above to build my site.
- I have read the Hugo Clarity theme documentation.
- I have used the example site's config files as reference.
- I have reviewed other issues in this repository and mine is not recorded.
Hugo version
hugo v0.148.2+extended+withdeploy linux/amd64
Where is this bug showing up?
On the command line: Hugo won't build the site and shows warnings or errors.
Operating system
Artix Linux 6.12.40-1-lts
Browser (if applicable)
No response
Current behavior
When defining variables 'umami_data_website_id' and 'umami_script_url' in params.toml the umami analytics is not added to the website and the tracking script is not loaded when browsing the website (in production, not development).
Expected behavior
When defining variables 'umami_data_website_id' and 'umami_script_url' in params.toml the umami analytics should be added to the website and the tracking script should be loaded when browsing the website (in production, not development).
Steps to reproduce
Define variables 'umami_data_website_id' and 'umami_script_url' in params.toml and build the website.
Open browser with developer tools and see that the script is not loaded from the network.
Check the source code in the browser and see that the script is not in the section.
Relevant log output
Related code
https://github.com/chipzoller/hugo-clarity/blob/master/exampleSite/config/_default/params.toml
lines 171-173
# Umami Analytics -- https://umami.is/
# umami_data_website_id = "GUID-8-4-4-4-12" # Umami Analytics data website id - GUID format (8-4-4-4-12)
# umami_script_url = "https://cloud.umami.is/script.js" # Umami Analytics script URL
https://github.com/chipzoller/hugo-clarity/blob/master/layouts/partials/analytics.html
lines 55-57
{{- with $config.umami_data_website_id }}
<script defer src="{{ $config.umami_script_url }}" data-website-id="{{ . }}"></script>
{{- end }}
Preferred solution
Since the umami config in params.toml actually falls under '[matomo_analytics]' on line 165, the '$config.umami_data_website_id' and '$config.umami_script_url' in analytics.html are not defined.
Moving the umami lines in params.toml higher up, for example after line 22 fixes this issue.
Other information
No response