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: settings/versioning.mdx
+57-13Lines changed: 57 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,16 @@
1
1
---
2
-
title: 'Versioning'
3
-
description: 'Build separate versions'
4
-
icon: 'square-chevron-down'
2
+
title: "Versioning & Localization"
3
+
description: "Build separate versions or localizations"
4
+
icon: "square-chevron-down"
5
5
---
6
6
7
+
Mintlify supports versioning or localization. You can use one or the other, not both.
8
+
7
9
These guides will assume `v1` pages are in a folder named `v1`, `v2` pages are in a folder named `v2`, and so on. While this method of structuring your files isn't strictly necessary, it's a great way to keep your files organized.
8
10
9
-
## Setup
11
+
## Versioning
12
+
13
+
### Setup
10
14
11
15
Add `"versions": ["v2", "v1"]` to your `mint.json` file where `v1` and `v2` are the names of your versions. You can put any number of versions in this array. The first version from the array serves as the default version.
12
16
@@ -26,7 +30,7 @@ If you would like to specify a default version, you can do so like this:
26
30
`mint.json`.
27
31
</Tip>
28
32
29
-
## Versioning Groups and Pages
33
+
###Versioning Groups and Pages
30
34
31
35
The best way to specify page versions is by adding a version value to a group in the navigation. When you specify the version of a group, that version is applied to all pages within that group.
32
36
@@ -45,17 +49,20 @@ You can also specify the version of a single page in the page metadata. Versions
45
49
46
50
```yaml Pages (quickstart.mdx)
47
51
---
48
-
title: 'Quickstart'
49
-
version: 'v2'
52
+
title: "Quickstart"
53
+
version: "v2"
50
54
---
51
55
```
56
+
52
57
</CodeGroup>
53
58
54
59
<Warning>
55
-
While it is possible to nest versioned groups within versioned groups, it is not recommended. If you do take this approach, the more deeply-nested version takes precedence.
60
+
While it is possible to nest versioned groups within versioned groups, it is
61
+
not recommended. If you do take this approach, the more deeply-nested version
62
+
takes precedence.
56
63
</Warning>
57
64
58
-
### Versioning Tabs and Anchors
65
+
####Versioning Tabs and Anchors
59
66
60
67
You can hide a tab or anchor based on a version. This is useful if you have links that are only relevant in one version. Importantly, this does **not** apply the version to the pages within that anchor.
61
68
@@ -100,17 +107,21 @@ In `mint.json`, simply add `version` to your tab or anchor. Tabs and anchors wit
100
107
},
101
108
],
102
109
```
110
+
103
111
</CodeGroup>
104
112
105
-
### Sharing Between Versions
113
+
####Sharing Between Versions
106
114
107
115
Not _all_ content has to be hidden though! Any content without a specified version appears in every version so you don't have to duplicate content!
108
116
109
117
<Tip>
110
-
When using localization with versioning, each version can have its own set of translations. This means you can have different language versions for different API versions, giving you full flexibility in managing both versioned and localized content.
118
+
When using localization with versioning, each version can have its own set of
119
+
translations. This means you can have different language versions for
120
+
different API versions, giving you full flexibility in managing both versioned
121
+
and localized content.
111
122
</Tip>
112
123
113
-
## Troubleshooting
124
+
###Troubleshooting
114
125
115
126
Common errors and how to fix them
116
127
@@ -119,11 +130,44 @@ Common errors and how to fix them
119
130
You likely nested a version inside of another. For example, your group had version "v1" but your page had version "v2".
120
131
121
132
We do not recommend nesting versions inside of each other because it's hard to maintain your docs later.
If you add versions to your docs and the pages disappeared from your
126
138
navigation, make sure you spelled the version the same as in your `versions`
127
139
array in `mint.json`.
128
140
</Accordion>
129
-
</AccordionGroup>
141
+
</AccordionGroup>
142
+
143
+
## Localization
144
+
145
+
### Setup
146
+
147
+
`"versions"` in your `mint.json` can be leveraged to create different language versions by adding a `locale` value to the version. The first localization from the array serves as the default localization.
148
+
149
+
We currently support localization in English (`en`), Chinese (`cn`), Spanish (`es`), French (`fr`), Japanese (`jp`), Portuguese (`pt`), and German (`de`).
150
+
151
+
```json mint.json example
152
+
"versions": [
153
+
{
154
+
"name": "English",
155
+
"locale": "en",
156
+
},
157
+
{
158
+
"name": "French",
159
+
"locale": "fr",
160
+
},
161
+
{
162
+
"name": "Spanish",
163
+
"locale": "es"
164
+
}
165
+
]
166
+
```
167
+
168
+
<Tip>
169
+
The versions dropdown will show your localizations in the order you include
170
+
them in the `mint.json`.
171
+
</Tip>
172
+
173
+
Once setup, the rest of localization is handled by the versioning setup described above.
0 commit comments