Repository navigation
feat(site): add Umami analytics - #195
Merged
Merged
Conversation
Adds the Umami tag to every page through the shared head partial, which baseof.html includes, so both the landing page and the docs layout get it. The script URL and website id are params in docs/hugo.toml rather than literals in the layout, so either can change without touching templates, and clearing one turns the tag off rather than emitting a half-filled tag. Emitted only when hugo.IsProduction, so a local `hugo server` — which runs in the development environment — does not record visits.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the Umami tag to every page of the site.
How
It lives in the shared
head.htmlpartial, whichbaseof.htmlincludes, so the landing page and the docs layout both get it from one edit.The script URL and website id are params in
docs/hugo.tomlrather than literals in the layout, so either can change without touching templates. Both must be set for the tag to render — a half-configured site emits nothing rather than a script tag with an emptydata-website-id.The tag is emitted only when
hugo.IsProduction.hugo serverruns in the development environment, so local previews record no visits.Verification
hugo --minify --gc)hugo --environment developmentpublic/entirelyhugo server,/,/install/,/agents/Collection itself was not verified from a headless browser — Umami ignores those.
Note
Production is Hugo's default environment, so any plain
hugorun reports to the live instance, not only CI. Adata-domainsallowlist would fix that, but the workflow builds with--baseURL "${PAGES_ORIGIN}${BASE_PATH}/", and if that origin ever resolved to the github.io host rather than the custom domain the allowlist would silently drop all real traffic. Dropping real data is worse than the stray local hit, so it is left off deliberately.