Variantes de contenu

Publiez de la documentation pour plusieurs versions de produit ou langues dans un seul site

You can publish multiple versions of the same documentation as part of a single docs site. These variants will be available to the end users via the space switcher in the top-left corner of the published site.

A GitBook screenshot showing a docs site's structure

Ajouter plusieurs langues ou versions

A site with multiple variants is useful if you need to group together the content of your spaces — such as if you’re documenting multiple versions of an API (v1, v2, v3, etc.), or documenting your content in different languages.

The spaces you link can contain any content, but it’s recommended to use variants as variations du même contenu. If the spaces you link are semantically different from each other, consider adding them as sections du site instead.

Ajout d'une variante à votre site de documentation

From your docs site’s dashboard, open the Paramètres tab in the site header, then click Structure. Here you can see all the content of your site.

To add a variant, click the Ajouter une variante button in the section you'd like to add to, then choose a space to link. The new variant is then added to the list of variants within the chosen section and will be available to visitors in the variant dropdown on your site.

Modification d'une variante

Vous pouvez modifier le nom et le slug de chacune de vos variantes en cliquant sur le Modifier button in the table row of the variant you’d like to edit. This will open a modal. Edit the field(s) you'd like to change, then click the Enregistrer button to save. You can also delete the variant by clicking the Supprimer la variante button in the lower left.

Changing a linked space's slug will change the space's canonical URL. GitBook will create an automatic redirect from the old URL to the new one. You can also créer des redirections manuellement.

To replace a variant’s linked space with a different space, first delete it by clicking its Modifier button, then click the Supprimer button in the lower left of the modal. Once the variant is deleted, click the Ajouter une variante button to add the new space.

Réorganisation des variantes

Votre site affiche les variantes dans l'ordre dans lequel elles apparaissent dans votre Structure du site table. Variants can be reordered by grabbing the Poignée de déplacement and moving it up or down. The changed order will be reflected on your site immediately.

You can also use the keyboard to select and move content: select a section or variant with the space bar, then use the arrow keys to move it up or down. Hit the space bar again to confirm the new position.

Définir une variante par défaut

If you have multiple variants within a section, one variant will be marked as the default. This variant is shown when visitors arrive on your site (or when they visit a section). Other variants each have a slug that is appended to the site's URL.

To set a variant as default, click on the Menu Actions dans la ligne du tableau de la variante puis cliquez sur Définir comme défaut.

Setting a variant as default removes its slug field, as it will be served from the section root instead. GitBook will redirect the variant's slug to the appropriate path, to ensure visitors keep seeing your content.

Supprimer une variante d'un site

To remove a variant from a site, open the Paramètres tab from your docs site dashboard, then click Structure to find the content you want to remove.

Ouvrez le Menu Actions pour la variante que vous souhaitez supprimer et choisissez Supprimer.

Mis à jour

Ce contenu vous a-t-il été utile ?