Aller au contenu principal
Version : 2.4.0

Créer un doc

Create a Markdown file,, and place it under the docs directory.

website # répertoire racine de votre site
├── docs
│ └──
├── src
│ └── pages
├── docusaurus.config.js
├── ...
description: Create a doc page with rich content.

# Hello from Docusaurus

Are you ready to create the documentation site for your open source project?

## Headers

will show up on the table of contents on the upper right

So that your users will know what this page is all about without scrolling down or even without reading too much.

## Only h2 and h3 will be in the TOC by default.

You can configure the TOC heading levels either per-document or in the theme configuration.

The headers are well-spaced so that the hierarchy is clear.

- lists will help you
- present the key points
- that you want your users to remember
- and you may nest them
- multiple times

All files prefixed with an underscore (_) under the docs directory are treated as "partial" pages and will be ignored by default.

Read more about importing partial pages.

Doc front matter

The front matter is used to provide additional metadata for your doc page. Le frontmatter est optionnel — Docusaurus pourra déduire toutes les métadonnées nécessaires sans le frontmatter. For example, the doc tags feature introduced below requires using front matter. For all possible fields, see the API documentation.

Doc tags

Optionally, you can add tags to your doc pages, which introduces another dimension of categorization in addition to the docs sidebar. Les tags sont passés dans le frontmatter comme une liste de libellés :

id: doc-with-tags
title: Un doc avec des tags
- Démo
- Pour commencer

Tags can also be declared with tags: [Demo, Getting started].

Read more about all the possible Yaml array syntaxes.

Organizing folder structure

How the Markdown files are arranged under the docs folder can have multiple impacts on Docusaurus content generation. Cependant, la plupart d'entre eux peuvent être découplés de la structure des fichiers.

Document ID

Every document has a unique id. By default, a document id is the name of the document (without the extension) relative to the root docs directory.

For example, the ID of is greeting, and the ID of guide/ is guide/hello.

website # Répertoire racine de votre site
└── docs
└── guide

However, the last part of the id can be defined by the user in the front matter. For example, if guide/'s content is defined as below, its final id is guide/part1.

id: part1

Lorem ipsum

L'ID est utilisé pour faire référence à un document lors de l'écriture manuelle de barres latérales ou lors de l'utilisation de composants ou de hooks liés à la mise en page de la documentation.

Doc URLs

By default, a document's URL location is its file path relative to the docs folder. Use the slug front matter to change a document's URL.

Par exemple, supposons que la structure de votre site ressemble à ceci :

website # Répertoire racine de votre site
└── docs
└── guide

By default will be available at /docs/guide/hello. You can change its URL location to /docs/bonjour:

slug: /bonjour

Lorem ipsum

slug will be appended to the doc plugin's routeBasePath, which is /docs by default. See Docs-only mode for how to remove the /docs part from the URL.


Il est possible d'utiliser :

  • absolute slugs: slug: /mySlug, slug: /...
  • relative slugs: slug: mySlug, slug: ./../mySlug...

If you want a document to be available at the root, and have a path like, you can use the slug front matter:

id: my-home-doc
slug: /

Lorem ipsum

When using autogenerated sidebars, the file structure will determine the sidebar structure.

Our recommendation for file system organization is: make your file system mirror the sidebar structure (so you don't need to handwrite your sidebars.js file), and use the slug front matter to customize URLs of each document.