메인 컨텐츠로 이동
버전: 3.5.2

문서 만들기

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

website # 사이트 루트 디렉터리
├── 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
참고

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. 프런트 매터는 선택 사항입니다. 도큐사우루스는 프런트 매터가 없어도 필요한 모든 메타데이터를 처리할 수 있습니다. For example, the doc tags feature introduced below requires using front matter. For all possible fields, see the API documentation.

Doc tags

Tags are declared in the front matter and introduce another dimension of categorization in addition to the docs sidebar.

It is possible to define tags inline, or to reference predefined tags declared in a tags file (optional, usually docs/tags.yml).

In the following example:

  • docusaurus references a predefined tag key declared in docs/tags.yml
  • Releases is an inline tag, because it does not exist in docs/tags.yml
docs/my-doc.md
---
tags:
- Releases
- docusaurus
---

# Title

Content
docs/tags.yml
docusaurus:
label: 'Docusaurus'
permalink: '/docusaurus'
description: 'Docs related to the Docusaurus framework'

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. 하지만 대부분은 파일 구조에서 분리될 수 있습니다.

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 greeting.md is greeting, and the ID of guide/hello.md is guide/hello.

website # 사이트 루트 디렉터리
└── docs
├── greeting.md
└── guide
└── hello.md

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

---
id: part1
---

Lorem ipsum

ID는 사이드바를 수작업으로 구성하거나 문서 관련 레이아웃 컴포넌트나 후크를 사용할 때 문서를 참조하기 위해 사용됩니다.

Doc URLs

By default, a document's URL location is its file path relative to the docs folder, with a few exceptions. Namely, if a file is named one the following, the file name won't be included in the URL:

  • Named as index (case-insensitive): docs/Guides/index.md
  • Named as README (case-insensitive): docs/Guides/README.mdx
  • Same name as parent folder: docs/Guides/Guides.md

In all cases, the default slug would only be /Guides, without the /index, /README, or duplicate /Guides segment.

참고

This convention is exactly the same as the category index convention. However, the isCategoryIndex configuration does not affect the document URL.

Use the slug front matter to change a document's URL.

예를 들어 사이트 구조가 다음과 같다고 가정합니다.

website # 사이트 루트 디렉터리
└── 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.

참고

다음과 같이 사용할 수 있습니다.

  • 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 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.