Pular para o conteúdo principal
Version: 2.2.0

Criar um documento

Crie um arquivo Markdown, greeting.md, e coloque no diretório docs.

website # root directory of your site
├── docs
│ └── greeting.md
├── 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
note

Todos os arquivos prefixados com um underscore (_) dentro do diretório docs serão tratados como paginas "partial" e serão ignoradas por padrão.

Leia mais sobre em importando uma página partial.

Doc front matter

The front matter is used to provide additional metadata for your doc page. Front matter is optional—Docusaurus will be able to infer all necessary metadata without the front matter. 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. Tags are passed in the front matter as a list of labels:

---
id: doc-with-tags
title: A doc with tags
tags:
- Demo
- Getting started
---
tip

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. However, most of them can be decoupled from the file structure.

ID do documento

Cada documento tem um id único. Por padrão, um id de documento é o nome do documento (sem a extensão) em relação ao diretório de documentos de raiz.

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

website # Root directory of your site
└── docs
├── greeting.md
└── guide
└── hello.md

However, the last part of the id can be defined by the user in the front matter. Por exemplo, se o conteúdo do guide/hello.mdfor definido como abaixo, seu id final é guide/part1.

---
id: part1
---

Lorem ipsum

The ID is used to refer to a document when hand-writing sidebars, or when using docs-related layout components or hooks.

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.

For example, suppose your site structure looks like this:

website # Root directory of your site
└── docs
└── guide
└── hello.md

By default hello.md 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.

note

É possível usar:

  • slugs absolutas: slug: /mySlug, slug: /...
  • slugs relativas: slug: mySlug, slug: ./../mySlug...

If you want a document to be available at the root, and have a path like https://docusaurus.io/docs/, 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.