Skip to content

Commit

Permalink
feat: add support for Google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo-sid committed Mar 11, 2023
1 parent 9cb14af commit 19bdd10
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ baseURL = 'https://hugo-blog-awesome.netlify.app/'
languageCode = 'en-us'
theme = "hugo-blog-awesome"

# To enable Google Analytics 4 (gtag.js) provide G-MEASUREMENT_ID below.
# To disable Google Analytics, simply leave the field empty or remove the next line
googleAnalytics = '' # G-MEASUREMENT_ID


# set markup.highlight.noClasses=false to enable code highlight
[markup]
Expand Down Expand Up @@ -37,4 +41,4 @@ theme = "hugo-blog-awesome"
avatar = "img/avatar.jpg"
intro = "Awesome hugo blog"
name = "Sidharth R"
description = "A minimalistic Hugo theme with light and dark mode support, for running a personal site or blog"
description = "A fast, minimalistic Hugo theme with light and dark mode support, for running a personal site or blog"
6 changes: 6 additions & 0 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,10 @@
{{/* Katex support (enabled on on specific pages). See 'helpers/katex.html' for more info. */}}

{{- if or .Params.math .Site.Params.math }}{{ partial "helpers/katex.html" . -}}{{- end -}}

{{/* Google analytics script. See config.toml to enable/disable this. */}}
{{- if hugo.IsProduction | or (eq site.Params.env "production") }}
{{ template "_internal/google_analytics.html" . }}
{{- end -}}

</head>

0 comments on commit 19bdd10

Please sign in to comment.