Debian Codegraph @

docs/content/en/configuration/versions.md

raw
1 ---
2 title: Configure versions
3 linkTitle: Versions
4 description: Configure versions.
5 categories: []
6 keywords: []
7 ---
8
9 {{< new-in 0.153.0 />}}
10
11 This is the default configuration:
12
13 {{< code-toggle config=versions />}}
14
15 ## Base settings
16
17 Configure the following base settings:
18
19 {{< code-toggle file=hugo >}}
20 defaultContentVersion = 'v1.0.0'
21 defaultContentVersionInSubdir = false
22 {{< /code-toggle >}}
23
24 `defaultContentVersion`
25 : (`string`) The project's [default version](g). When one or more versions are defined, this value must match one of the defined version names.
26
27 `defaultContentVersionInSubdir`
28 : (`bool`) Whether to publish the default content version to a subdirectory matching the [`defaultContentVersion`](#defaultcontentversion). Default is `false`.
29
30 ## Version settings
31
32 Use the following setting to define how Hugo orders versions.
33
34 `weight`
35 : (`int`) The version [weight](g). When set to a non-zero value, this is the primary sort criteria for this version.
36
37 ## Sort order
38
39 Hugo sorts versions by weight in ascending order, then by their [semantic version][] in descending order. This affects build order and complement selection.
40
41 ## Example
42
43 The following configuration demonstrates how to define multiple versions with specific weights.
44
45 {{< code-toggle >}}
46 [versions."v1.0.0"]
47 weight = 20
48 [versions."v2.0.0"]
49 weight = 10
50 {{< /code-toggle >}}
51
52 [semantic version]: https://semver.org/