--- title: IsDefault description: Reports whether the given site is the default site across all dimensions. categories: [] keywords: [] params: functions_and_methods: returnType: bool signatures: [SITE.IsDefault] --- {{< new-in 0.156.0 />}} The `IsDefault` method on a `Site` object reports whether the given site is the [default site](g) across all dimensions: [language](g), [version](g), and [role](g). This is useful to ensure that a block of code executes only once per build, regardless of the number of [sites](g) generated by your [dimensions](g). For example, the following configuration defines a matrix of sites across language and version dimensions. {{< code-toggle file=hugo >}} [languages.de] contentDir = 'content/de' direction = 'ltr' label = 'Deutsch' locale = 'de-DE' title = 'Projekt Dokumentation' weight = 1 [languages.en] contentDir = 'content/en' direction = 'ltr' label = 'English' locale = 'en-US' title = 'Project Documentation' weight = 2 [versions.'v1.0.0'] [versions.'v2.0.0'] [versions.'v3.0.0'] {{< /code-toggle >}} If you call an initialization _partial_ template to handle one-time build logic or global variable setup, wrap that call in an [`if`][] statement using this function. This prevents the logic from being executed for every dimensional variation. ```go-html-template {{ if .Site.IsDefault }} {{ partial "init.html" . }} {{ end }} ``` In this setup, the code block is only executed for the English version v3.0.0 site. English is selected because the [`defaultContentLanguage`][] setting is not defined, making English the [default language](g). Version v3.0.0 is selected because the [`defaultContentVersion`][] setting is not defined, making v3.0.0 the [default version](g). [`defaultContentLanguage`]: /configuration/all/#defaultcontentlanguage [`defaultContentVersion`]: /configuration/all/#defaultcontentversion [`if`]: /functions/go-template/if/