You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/configuration/languages.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ languageCode
56
56
Access this value from a template using the [`Language.LanguageCode`][] method on a `Site` or `Page` object.
57
57
58
58
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`.
60
60
61
61
languageName
62
62
: (`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
67
67
weight
68
68
: (`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.
69
69
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
+
70
74
## Localized settings
71
75
72
76
Some configuration settings can be defined separately for each language. For example:
Copy file name to clipboardExpand all lines: content/en/configuration/versions.md
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,15 +12,26 @@ This is the default configuration:
12
12
13
13
{{< code-toggle config=versions />}}
14
14
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.
16
29
17
30
{{< code-toggle >}}
18
31
[versions."v1.0.0"]
19
-
weight = 0
32
+
weight = 20
20
33
[versions."v2.0.0"]
21
-
weight = 0
34
+
weight = 10
22
35
{{< /code-toggle >}}
23
36
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.
description: Returns the language object for the given page.
3
+
description: Returns the Language object for the given page.
4
4
categories: []
5
5
keywords: []
6
6
params:
@@ -9,13 +9,13 @@ params:
9
9
signatures: [PAGE.Language]
10
10
---
11
11
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.
13
13
14
-
You can also use the `Language` method on a `Site` object. See [details].
14
+
You can also use the `Language` method on a `Site` object. See [details][].
15
15
16
16
## Methods
17
17
18
-
The examples below assume the following in the site configuration:
18
+
The examples below assume the following in your project configuration:
19
19
20
20
{{< code-toggle file=hugo >}}
21
21
[languages.de]
@@ -29,60 +29,66 @@ weight = 2
29
29
30
30
{{< new-in 0.153.0 />}}
31
31
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][].
33
33
34
34
```go-html-template
35
35
{{ .Language.IsDefault }} → true
36
36
```
37
37
38
38
### Lang
39
39
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.
41
41
42
42
```go-html-template
43
43
{{ .Language.Lang }} → de
44
44
```
45
45
46
46
### LanguageCode
47
47
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.
49
49
50
50
```go-html-template
51
51
{{ .Language.LanguageCode }} → de-DE
52
52
```
53
53
54
54
### LanguageDirection
55
55
56
-
(`string`) The language direction from the site configuration, either `ltr` or `rtl`.
56
+
(`string`) Returns the [`languageDirection`][] from your project configuration.
57
57
58
58
```go-html-template
59
59
{{ .Language.LanguageDirection }} → ltr
60
60
```
61
61
62
62
### LanguageName
63
63
64
-
(`string`) The language name from the site configuration.
64
+
(`string`) Returns the [`languageName`][] from your project configuration.
65
65
66
66
```go-html-template
67
67
{{ .Language.LanguageName }} → Deutsch
68
68
```
69
69
70
70
### Name
71
71
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`.
73
75
74
76
```go-html-template
75
-
{{ .Site.Language.Name }} → de
77
+
{{ .Language.Name }} → de
76
78
```
77
79
78
80
### Weight
79
81
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.
Copy file name to clipboardExpand all lines: content/en/methods/site/Language.md
+18-12Lines changed: 18 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Language
3
-
description: Returns the language object for the given site.
3
+
description: Returns the Language object for the given site.
4
4
categories: []
5
5
keywords: []
6
6
params:
@@ -9,13 +9,13 @@ params:
9
9
signatures: [SITE.Language]
10
10
---
11
11
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.
13
13
14
-
You can also use the `Language` method on a `Page` object. See [details].
14
+
You can also use the `Language` method on a `Page` object. See [details][].
15
15
16
16
## Methods
17
17
18
-
The examples below assume the following in the site configuration:
18
+
The examples below assume the following in your project configuration:
19
19
20
20
{{< code-toggle file=hugo >}}
21
21
[languages.de]
@@ -29,55 +29,57 @@ weight = 1
29
29
30
30
{{< new-in 0.153.0 />}}
31
31
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][].
33
33
34
34
```go-html-template
35
35
{{ .Site.Language.IsDefault }} → true
36
36
```
37
37
38
38
### Lang
39
39
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.
41
41
42
42
```go-html-template
43
43
{{ .Site.Language.Lang }} → de
44
44
```
45
45
46
46
### LanguageCode
47
47
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.
49
49
50
50
```go-html-template
51
51
{{ .Site.Language.LanguageCode }} → de-DE
52
52
```
53
53
54
54
### LanguageDirection
55
55
56
-
(`string`) The language direction from the site configuration, either `ltr` or `rtl`.
56
+
(`string`) Returns the [`languageDirection`][] from your project configuration.
57
57
58
58
```go-html-template
59
59
{{ .Site.Language.LanguageDirection }} → ltr
60
60
```
61
61
62
62
### LanguageName
63
63
64
-
(`string`) The language name from the site configuration.
64
+
(`string`) Returns the [`languageName`][] from your project configuration.
65
65
66
66
```go-html-template
67
67
{{ .Site.Language.LanguageName }} → Deutsch
68
68
```
69
69
70
70
### Name
71
71
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`.
73
75
74
76
```go-html-template
75
77
{{ .Site.Language.Name }} → de
76
78
```
77
79
78
80
### Weight
79
81
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.
81
83
82
84
```go-html-template
83
85
{{ .Site.Language.Weight }} → 1
@@ -94,6 +96,10 @@ Some of the methods above are commonly used in a base template as attributes for
description: Returns the role object for the given site.
3
+
description: Returns the Role object for the given site.
4
4
categories: []
5
5
keywords: []
6
6
params:
7
7
functions_and_methods:
8
-
returnType: roles.RoleSite
8
+
returnType: roles.Role
9
9
signatures: [SITE.Role]
10
10
---
11
11
12
12
{{< new-in 0.153.0 />}}
13
13
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.
15
15
16
16
## Methods
17
17
18
18
### IsDefault
19
19
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][].
21
21
22
22
```go-html-template
23
23
{{ .Site.Role.IsDefault }} → true
24
24
```
25
25
26
26
### Name
27
27
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.
description: Returns the version object for the given site.
3
+
description: Returns the Version object for the given site.
4
4
categories: []
5
5
keywords: []
6
6
params:
@@ -11,24 +11,24 @@ params:
11
11
12
12
{{< new-in 0.153.0 />}}
13
13
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.
15
15
16
16
## Methods
17
17
18
18
### IsDefault
19
19
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][].
21
21
22
22
```go-html-template
23
23
{{ .Site.Version.IsDefault }} → true
24
24
```
25
25
26
26
### Name
27
27
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.
Copy file name to clipboardExpand all lines: content/en/quick-reference/glossary/default-language.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: default language
3
3
---
4
4
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.
Copy file name to clipboardExpand all lines: content/en/quick-reference/glossary/default-role.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: default role
3
3
---
4
4
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.
Copy file name to clipboardExpand all lines: content/en/quick-reference/glossary/default-version.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: default version
3
3
---
4
4
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.
0 commit comments