Debian Codegraph @

docs/content/en/methods/site/Config.md

raw
1 ---
2 title: Config
3 description: Returns a subset of your project configuration.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: page.SiteConfig
9 signatures: [SITE.Config]
10 ---
11
12 The `Config` method on a `Site` object provides access to a subset of your project configuration, specifically the `services` and `privacy` keys.
13
14 ## Services
15
16 See [configure services][].
17
18 For example, to use Hugo's built-in Google Analytics template you must add a [Google tag ID][]:
19
20 {{< code-toggle file=hugo >}}
21 [services.googleAnalytics]
22 id = 'G-XXXXXXXXX'
23 {{< /code-toggle >}}
24
25 To access this value from a template:
26
27 ```go-html-template
28 {{ .Site.Config.Services.GoogleAnalytics.ID }} → G-XXXXXXXXX
29 ```
30
31 You must capitalize each identifier as shown above.
32
33 ## Privacy
34
35 See [configure privacy][].
36
37 For example, to disable usage of the built-in YouTube shortcode:
38
39 {{< code-toggle file=hugo >}}
40 [privacy.youtube]
41 disable = true
42 {{< /code-toggle >}}
43
44 To access this value from a template:
45
46 ```go-html-template
47 {{ .Site.Config.Privacy.YouTube.Disable }} → true
48 ```
49
50 You must capitalize each identifier as shown above.
51
52 [Google tag ID]: https://support.google.com/tagmanager/answer/12326985?hl=en
53 [configure privacy]: /configuration/privacy/
54 [configure services]: /configuration/services/