Skip to content

Commit 12a9fe4

Browse files
committed
content: Various dimension improvements
1 parent 349b549 commit 12a9fe4

File tree

10 files changed

+87
-49
lines changed

10 files changed

+87
-49
lines changed

content/en/configuration/languages.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ languageCode
5656
Access this value from a template using the [`Language.LanguageCode`][] method on a `Site` or `Page` object.
5757

5858
languageDirection
59-
: (`string`) The language direction, either left-to-right (`ltr`) or right-to-left (`rtl`). Use this value in your templates with the global [`dir`][] HTML attribute. Access this value from a template using the [`Language.LanguageDirection`][] method on a `Site` or `Page` object.
59+
: (`string`) The language direction, either left-to-right (`ltr`) or right-to-left (`rtl`). Use this value in your templates with the global [`dir`][] HTML attribute. Access this value from a template using the [`Language.LanguageDirection`][] method on a `Site` or `Page` object. Default is `ltr`.
6060

6161
languageName
6262
: (`string`) The language name, typically used when rendering a language switcher. Access this value from a template using the [`Language.LanguageName`][] method on a `Site` or `Page` object.
@@ -67,6 +67,10 @@ title
6767
weight
6868
: (`int`) The language [weight](g). When set to a non-zero value, this is the primary sort criteria for this language. Access this value from a template using the [`Language.Weight`][] method on a `Site` or `Page` object.
6969

70+
## Sort order
71+
72+
Hugo sorts languages by weight in ascending order, then lexicographically in ascending order. This affects build order and complement selection.
73+
7074
## Localized settings
7175

7276
Some configuration settings can be defined separately for each language. For example:

content/en/configuration/roles.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,24 @@ This is the default configuration:
1212

1313
{{< code-toggle config=roles />}}
1414

15-
To define "guest" and "member" roles:
15+
## Settings
16+
17+
Use the following setting to define how Hugo orders roles.
18+
19+
weight
20+
: (`int`) The role [weight](g).
21+
22+
## Sort order
23+
24+
Hugo sorts roles by weight in ascending order, then lexicographically in ascending order. This affects build order and complement selection.
25+
26+
## Example
27+
28+
The following configuration demonstrates how to define multiple roles with specific weights.
1629

1730
{{< code-toggle >}}
1831
[roles.guest]
1932
weight = 20
2033
[roles.member]
2134
weight = 10
2235
{{< /code-toggle >}}
23-
24-
Roles are sorted by their [weight](g) in descending order, then by their name in descending order. This affects build order and complement selection.

content/en/configuration/versions.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,26 @@ This is the default configuration:
1212

1313
{{< code-toggle config=versions />}}
1414

15-
To define "v1.0.0" and "v2.0.0" versions:
15+
## Settings
16+
17+
Use the following setting to define how Hugo orders versions.
18+
19+
weight
20+
: (`int`) The language [weight](g).
21+
22+
## Sort order
23+
24+
Hugo sorts versions by weight in ascending order, then by their [semantic version][] in descending order. This affects build order and complement selection.
25+
26+
## Example
27+
28+
The following configuration demonstrates how to define multiple versions with specific weights.
1629

1730
{{< code-toggle >}}
1831
[versions."v1.0.0"]
19-
weight = 0
32+
weight = 20
2033
[versions."v2.0.0"]
21-
weight = 0
34+
weight = 10
2235
{{< /code-toggle >}}
2336

24-
Versions are sorted by their [weight](g) in ascending order, then by their [semantic version] in descending order. This affects build order and complement selection.
25-
2637
[semantic version]: https://semver.org/
Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Language
3-
description: Returns the language object for the given page.
3+
description: Returns the Language object for the given page.
44
categories: []
55
keywords: []
66
params:
@@ -9,13 +9,13 @@ params:
99
signatures: [PAGE.Language]
1010
---
1111

12-
The `Language` method on a `Page` object returns the language object for the given page. The language object is derived from the language definition in the site configuration.
12+
The `Language` method on a `Page` object returns the `Language` object for the given page, derived from the language definition in your project configuration.
1313

14-
You can also use the `Language` method on a `Site` object. See&nbsp;[details].
14+
You can also use the `Language` method on a `Site` object. See&nbsp;[details][].
1515

1616
## Methods
1717

18-
The examples below assume the following in the site configuration:
18+
The examples below assume the following in your project configuration:
1919

2020
{{< code-toggle file=hugo >}}
2121
[languages.de]
@@ -29,60 +29,66 @@ weight = 2
2929

3030
{{< new-in 0.153.0 />}}
3131

32-
(`bool`) Reports whether this is the default language object as defined by the [`defaultContentLanguage`][] setting in the site configuration.
32+
(`bool`) Reports whether this is the [default language][].
3333

3434
```go-html-template
3535
{{ .Language.IsDefault }} → true
3636
```
3737

3838
### Lang
3939

40-
(`string`) The language tag as defined by [RFC 5646]. This is the lower cased key from the site configuration.
40+
(`string`) Returns the language tag as defined by [RFC 5646][]. This is the lowercased key from your project configuration.
4141

4242
```go-html-template
4343
{{ .Language.Lang }} → de
4444
```
4545

4646
### LanguageCode
4747

48-
(`string`) The language code from the site configuration. Falls back to `Lang` if not defined.
48+
(`string`) Returns the [`languageCode`][] from your project configuration. Falls back to `Lang` if not defined.
4949

5050
```go-html-template
5151
{{ .Language.LanguageCode }} → de-DE
5252
```
5353

5454
### LanguageDirection
5555

56-
(`string`) The language direction from the site configuration, either `ltr` or `rtl`.
56+
(`string`) Returns the [`languageDirection`][] from your project configuration.
5757

5858
```go-html-template
5959
{{ .Language.LanguageDirection }} → ltr
6060
```
6161

6262
### LanguageName
6363

64-
(`string`) The language name from the site configuration.
64+
(`string`) Returns the [`languageName`][] from your project configuration.
6565

6666
```go-html-template
6767
{{ .Language.LanguageName }} → Deutsch
6868
```
6969

7070
### Name
7171

72-
(`string`) The language tag as defined by [RFC 5646]. This is the lower cased key used in the site configuration. This is an alias for `Lang`.
72+
{{< new-in 0.153.0 />}}
73+
74+
(`string`) Returns the language tag as defined by [RFC 5646][]. This is the lowercased key from your project configuration. This is an alias for `Lang`.
7375

7476
```go-html-template
75-
{{ .Site.Language.Name }} → de
77+
{{ .Language.Name }} → de
7678
```
7779

7880
### Weight
7981

80-
(`int`) The language weight from the site configuration which determines its order in the slice of languages returned by the `Languages` method on a `Site` object.
82+
(`int`) Returns the language [`weight`][] from your project configuration.
8183

8284
```go-html-template
8385
{{ .Language.Weight }} → 2
8486
```
8587

86-
[`defaultContentLanguage`]: /configuration/all/#defaultcontentlanguage
87-
[details]: /methods/site/language/
88+
[`languageCode`]: /configuration/languages/#languagecode
89+
[`languageDirection`]: /configuration/languages/#languagedirection
90+
[`languageName`]: /configuration/languages/#languagename
91+
[`weight`]: /configuration/languages/#weight
92+
[default language]: /quick-reference/glossary/#default-language
93+
[details]: /methods/page/language/
8894
[RFC 5646]: https://datatracker.ietf.org/doc/html/rfc5646

content/en/methods/site/Language.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Language
3-
description: Returns the language object for the given site.
3+
description: Returns the Language object for the given site.
44
categories: []
55
keywords: []
66
params:
@@ -9,13 +9,13 @@ params:
99
signatures: [SITE.Language]
1010
---
1111

12-
The `Language` method on a `Page` object returns the language object for the given page. The language object is derived from the language definition in the site configuration.
12+
The `Language` method on a `Site` object returns the `Language` object for the given site, derived from the language definition in your project configuration.
1313

14-
You can also use the `Language` method on a `Page` object. See&nbsp;[details].
14+
You can also use the `Language` method on a `Page` object. See&nbsp;[details][].
1515

1616
## Methods
1717

18-
The examples below assume the following in the site configuration:
18+
The examples below assume the following in your project configuration:
1919

2020
{{< code-toggle file=hugo >}}
2121
[languages.de]
@@ -29,55 +29,57 @@ weight = 1
2929

3030
{{< new-in 0.153.0 />}}
3131

32-
(`bool`) Reports whether this is the default language object as defined by the [`defaultContentLanguage`][] setting in the site configuration.
32+
(`bool`) Reports whether this is the [default language][].
3333

3434
```go-html-template
3535
{{ .Site.Language.IsDefault }} → true
3636
```
3737

3838
### Lang
3939

40-
(`string`) The language tag as defined by [RFC 5646]. This is the lower cased key from the site configuration.
40+
(`string`) Returns the language tag as defined by [RFC 5646][]. This is the lowercased key from your project configuration.
4141

4242
```go-html-template
4343
{{ .Site.Language.Lang }} → de
4444
```
4545

4646
### LanguageCode
4747

48-
(`string`) The language code from the site configuration. Falls back to `Lang` if not defined.
48+
(`string`) Returns the [`languageCode`][] from your project configuration. Falls back to `Lang` if not defined.
4949

5050
```go-html-template
5151
{{ .Site.Language.LanguageCode }} → de-DE
5252
```
5353

5454
### LanguageDirection
5555

56-
(`string`) The language direction from the site configuration, either `ltr` or `rtl`.
56+
(`string`) Returns the [`languageDirection`][] from your project configuration.
5757

5858
```go-html-template
5959
{{ .Site.Language.LanguageDirection }} → ltr
6060
```
6161

6262
### LanguageName
6363

64-
(`string`) The language name from the site configuration.
64+
(`string`) Returns the [`languageName`][] from your project configuration.
6565

6666
```go-html-template
6767
{{ .Site.Language.LanguageName }} → Deutsch
6868
```
6969

7070
### Name
7171

72-
(`string`) The language tag as defined by [RFC 5646]. This is the lower cased key from the site configuration. This is an alias for `Lang`.
72+
{{< new-in 0.153.0 />}}
73+
74+
(`string`) Returns the language tag as defined by [RFC 5646][]. This is the lowercased key from your project configuration. This is an alias for `Lang`.
7375

7476
```go-html-template
7577
{{ .Site.Language.Name }} → de
7678
```
7779

7880
### Weight
7981

80-
(`int`) The language weight from the site configuration which determines its order in the slice of languages returned by the `Languages` method on a `Site` object.
82+
(`int`) Returns the language [`weight`][] from your project configuration.
8183

8284
```go-html-template
8385
{{ .Site.Language.Weight }} → 1
@@ -94,6 +96,10 @@ Some of the methods above are commonly used in a base template as attributes for
9496
>
9597
```
9698

97-
[`defaultContentLanguage`]: /configuration/all/#defaultcontentlanguage
99+
[`languageCode`]: /configuration/languages/#languagecode
100+
[`languageDirection`]: /configuration/languages/#languagedirection
101+
[`languageName`]: /configuration/languages/#languagename
102+
[`weight`]: /configuration/languages/#weight
103+
[default language]: /quick-reference/glossary/#default-language
98104
[details]: /methods/page/language/
99105
[RFC 5646]: https://datatracker.ietf.org/doc/html/rfc5646

content/en/methods/site/Role.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
---
22
title: Role
3-
description: Returns the role object for the given site.
3+
description: Returns the Role object for the given site.
44
categories: []
55
keywords: []
66
params:
77
functions_and_methods:
8-
returnType: roles.RoleSite
8+
returnType: roles.Role
99
signatures: [SITE.Role]
1010
---
1111

1212
{{< new-in 0.153.0 />}}
1313

14-
The `Role` method on a `Site` object returns the role object for the given site. The role object is derived from the role definition in the site configuration.
14+
The `Role` method on a `Site` object returns the `Role` object for the given site, derived from the role definition in your site configuration.
1515

1616
## Methods
1717

1818
### IsDefault
1919

20-
(`bool`) Reports whether this is the default role object as defined by the [`defaultContentRole`][] setting in the site configuration.
20+
(`bool`) Reports whether this is the [default role][].
2121

2222
```go-html-template
2323
{{ .Site.Role.IsDefault }} → true
2424
```
2525

2626
### Name
2727

28-
(`string`) Returns the role name. This is the lower cased key from the site configuration.
28+
(`string`) Returns the role name. This is the lowercased key from your site configuration.
2929

3030
```go-html-template
3131
{{ .Site.Role.Name }} → guest
3232
```
3333

34-
[`defaultContentRole`]: /configuration/all/#defaultcontentrole
34+
[default role]: /quick-reference/glossary/#default-role

content/en/methods/site/Version.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Version
3-
description: Returns the version object for the given site.
3+
description: Returns the Version object for the given site.
44
categories: []
55
keywords: []
66
params:
@@ -11,24 +11,24 @@ params:
1111

1212
{{< new-in 0.153.0 />}}
1313

14-
The `Version` method on a `Site` object returns the version object for the given site. The version object is derived from the version definition in the site configuration.
14+
The `Version` method on a `Site` object returns the `Version` object for the given site, derived from the version definition in your site configuration.
1515

1616
## Methods
1717

1818
### IsDefault
1919

20-
(`bool`) Reports whether this is the default version object as defined by the [`defaultContentVersion`][] setting in the site configuration.
20+
(`bool`) Reports whether this is the [default version][].
2121

2222
```go-html-template
2323
{{ .Site.Version.IsDefault }} → true
2424
```
2525

2626
### Name
2727

28-
(`string`) Returns the version name. This is the lower cased key from the site configuration.
28+
(`string`) Returns the version name. This is the lowercased key from your site configuration.
2929

3030
```go-html-template
3131
{{ .Site.Version.Name }} → v1.0.0
3232
```
3333

34-
[`defaultContentVersion`]: /configuration/all/#defaultcontentversion
34+
[default version]: /quick-reference/glossary/#default-version

content/en/quick-reference/glossary/default-language.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: default language
33
---
44

5-
The _default language_ is is the value defined by the [`defaultContentLanguage`][] setting, falling back to the first language in the project, and finally to `en`. This first language is identified by the lowest [_weight_](g), using lexicographical order as the final fallback if weights are tied or undefined.
5+
The _default language_ is is the value defined by the [`defaultContentLanguage`][] setting, falling back to the first language in the project, and finally to `en`. The first language is identified by the lowest [_weight_](g), using lexicographical order as the final fallback if weights are tied or undefined.
66

77
See also: [_language_](g).
88

content/en/quick-reference/glossary/default-role.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: default role
33
---
44

5-
The _default role_ is the value defined by the [`defaultContentRole`][] setting, falling back to the first role in the project, and finally to `guest`. This first role is identified by the lowest [_weight_](g), using lexicographical order as the final fallback if weights are tied or undefined.
5+
The _default role_ is the value defined by the [`defaultContentRole`][] setting, falling back to the first role in the project, and finally to `guest`. The first role is identified by the lowest [_weight_](g), using lexicographical order as the final fallback if weights are tied or undefined.
66

77
See also: [_role_](g).
88

content/en/quick-reference/glossary/default-version.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: default version
33
---
44

5-
The _default version_ is the value defined by the [`defaultContentVersion`][] setting, falling back to the first version in the project, and finally to `v1.0.0`. This first version is identified by the lowest [_weight_](g), using a descending semantic sort as the final fallback if weights are tied or undefined.
5+
The _default version_ is the value defined by the [`defaultContentVersion`][] setting, falling back to the first version in the project, and finally to `v1.0.0`. The first version is identified by the lowest [_weight_](g), using a descending semantic sort as the final fallback if weights are tied or undefined.
66

77
See also: [_version_](g).
88

0 commit comments

Comments
 (0)