Skip to content

Commit 3162be6

Browse files
committed
Refer reader to Hugo docs
1 parent dbb7815 commit 3162be6

File tree

2 files changed

+25
-40
lines changed

2 files changed

+25
-40
lines changed

userguide/config.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ pygmentsUseClassic = false
2020
# See https://help.farbox.com/pygments.html
2121
pygmentsStyle = "tango"
2222

23-
# FIXME: https://github.com/google/docsy/issues/1097
24-
googleAnalytics = "UA-00000000-0"
25-
2623
# First one is picked as the Twitter card image if not set on page.
2724
#images = ["images/project-illustration.png"]
2825

@@ -45,6 +42,10 @@ anchor = "smart"
4542
url = "https://example.docsy.dev"
4643
post = '<sup><i class="pl-1 fas fa-external-link-alt fa-xs" aria-hidden="true"></i></sup>'
4744

45+
[services]
46+
[services.googleAnalytics]
47+
id = "UA-00000000-0" # FIXME: https://github.com/google/docsy/issues/1097
48+
4849
# Language configuration
4950

5051
[languages]

userguide/content/en/docs/Adding content/feedback.md

+21-37
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ description: >-
99

1010
## Adding Analytics
1111

12-
The Docsy theme builds upon Hugo's support for [Google Analytics][], which Hugo
13-
provides through [internal templates][]. Once you set up analytics as described
14-
below, usage information for your site (such as page views) is sent to your
15-
Google Analytics account.
12+
The Docsy theme builds upon [Hugo's support for Google Analytics][hugo-ga],
13+
which Hugo provides through [internal templates][]. Once you set up analytics as
14+
described below, usage information for your site (such as page views) is sent to
15+
your [Google Analytics][] account.
1616

1717
### Prerequisites
1818

@@ -30,48 +30,30 @@ started** section of [Introducing Google Analytics 4 (GA4)][ga4-intro].
3030

3131
### Setup
3232

33-
Add the following site parameter to your project's configuration file:
33+
Enable Google Analytics by adding your project's analytics ID to the site
34+
configuration file. For details, see [Configure Google Analytics][].
3435

35-
{{< tabpane persistLang=false >}}
36-
{{< tab header="Configuration file:" disabled=true />}}
37-
{{< tab header="config.toml" lang="toml" >}}
38-
39-
googleAnalytics = "PUT-YOUR-ANALYTICS-ID-HERE"
40-
41-
{{< /tab >}} {{< tab header="config.yaml" lang="yaml" >}}
36+
{{% alert title="Warning" color="warning" %}}
37+
<!-- Remove this warning once the Hugo docs have been updated to include it. -->
4238

43-
googleAnalytics: PUT-YOUR-ANALYTICS-ID-HERE
39+
You can configure your project's analytics ID by setting either the top-level
40+
`googleAnalytics` config parameter or `services.googleAnalytics.id`. **Do not
41+
define both** otherwise this will likely result in [unexpected behavior][].
42+
For details, see [Is `services.googleAnalytics.id` an alias for
43+
`googleAnalytics`][alias-discussion].
4444

45-
{{< /tab >}} {{< tab header="config.json" lang="json" >}}
46-
{
47-
"googleAnalytics": "PUT-YOUR-ANALYTICS-ID-HERE"
48-
}
45+
[alias-discussion]: https://discourse.gohugo.io/t/config-is-services-googleanalytics-id-an-alias-for-googleanalytics/39469
46+
[unexpected behavior]: https://github.com/google/docsy/issues/921
4947

50-
{{< /tab >}}
51-
{{< /tabpane >}}
48+
{{% /alert %}}
5249

53-
{{% alert title="Production-only feature!" color="warning" %}}
50+
{{% alert title="Production-only feature!" color="primary" %}}
5451

5552
Analytics are enabled _only_ for **production** builds (called "environments"
5653
in Hugo terminology). For the information Hugo environments and how to set
5754
them, see the following [discussion][].
5855

59-
[discussion]: https://discourse.gohugo.io/t/what-does-setting-hugo-env-to-production-do/24669/2?u=chalin
60-
61-
{{% /alert %}}
62-
63-
{{% alert title="Upgrade warning" color="warning" %}}
64-
65-
Earlier versions of Docsy recommended setting the
66-
`services.googleAnalytics.id` config parameter to enable analytics. Upgrade
67-
your configuration as outlined above. **Do not** set both this parameter _and_
68-
the top-level `googleAnalytics`, otherwise this will likely result in
69-
[unexpected behavior][]. For more details about how these two parameters are
70-
related, see [Is `services.googleAnalytics.id` an alias for
71-
`googleAnalytics`][alias-discussion].
72-
73-
[alias-discussion]: https://discourse.gohugo.io/t/config-is-services-googleanalytics-id-an-alias-for-googleanalytics/39469?u=chalin
74-
[unexpected behavior]: https://github.com/google/docsy/issues/921
56+
[discussion]: https://discourse.gohugo.io/t/what-does-setting-hugo-env-to-production-do/24669/2
7557

7658
{{% /alert %}}
7759

@@ -315,6 +297,8 @@ Then the meta `description` tag on the rendered page is:
315297

316298
You can add additional meta tags to your own copy of the `head-end.html` partial. See [Customizing templates]({{< ref "lookandfeel#customizing-templates" >}}) for more information.
317299

300+
[Configure Google Analytics]: https://gohugo.io/templates/internal/#configure-google-analytics
318301
[ga4-intro]: https://support.google.com/analytics/answer/1042508
319302
[Google Analytics]: https://analytics.google.com/analytics/web/
320-
[internal templates]: https://gohugo.io/templates/internal/#google-analytics
303+
[hugo-ga]: https://gohugo.io/templates/internal/#google-analytics
304+
[internal templates]: https://gohugo.io/templates/internal/

0 commit comments

Comments
 (0)