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

문서 개요

문서 기능을 사용해 계층 구조 내에서 사용자는 마크다운 파일을 작성할 수 있습니다.

정보

Check the Docs Plugin API Reference documentation for an exhaustive list of options.

여러분의 사이트 문서화는 가장 낮은 수준에서 가장 높은 수준까지 4가지 수준으로 구성되어 있습니다.

  1. 개별 페이지
  2. 사이드바.
  3. 버전.
  4. 플러그인 인스턴스

The guide will introduce them in that order: starting from how individual pages can be configured, to how to create a sidebar or multiple ones, to how to create and manage versions, to how to use multiple docs plugin instances.

Docs-only mode

새롭게 초기화된 도큐사우루스 사이트 구조는 다음과 같습니다.

example.com/                                -> generated from `src/pages/index.js`

example.com/docs/intro -> generated from `docs/intro.md`
example.com/docs/tutorial-basics/... -> generated from `docs/tutorial-basics/...`
...

example.com/blog/2021/08/26/welcome -> generated from `blog/2021-08-26-welcome/index.md`
example.com/blog/2021/08/01/mdx-blog-post -> generated from `blog/2021-08-01-mdx-blog-post.mdx`
...

All docs will be served under the subroute docs/. But what if your site only has docs, or you want to prioritize your docs by putting them at the root?

사이트 구성이 다음과 같은 경우를 생각해보죠.

docusaurus.config.js
export default {
// ...
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
/* docs plugin options */
},
blog: {
/* blog plugin options */
},
// ...
},
],
],
};

문서 전용 모드를 사용하려면 다음과 같이 변경하세요.

docusaurus.config.js
export default {
// ...
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
routeBasePath: '/', // Serve the docs at the site's root
/* other docs plugin options */
},
blog: false, // Optional: disable the blog plugin
// ...
},
],
],
};

Note that you don't necessarily have to give up on using the blog or other plugins; all that routeBasePath: '/' does is that instead of serving the docs through https://example.com/docs/some-doc, they are now at the site root: https://example.com/some-doc. The blog, if enabled, can still be accessed through the blog/ subroute.

Don't forget to put some page at the root (https://example.com/) through adding the front matter:

docs/intro.md
---
slug: /
---

This page will be the home page when users visit https://example.com/.
warning

If you added slug: / to a doc to make it the homepage, you should delete the existing homepage at ./src/pages/index.js, or else there will be two files mapping to the same route!

사이트 구조는 아래와 비슷하게 만들어졌을 겁니다.

example.com/                       -> generated from `docs/intro.md`
example.com/tutorial-basics/... -> generated from `docs/tutorial-basics/...`
...

There's also a "blog-only mode" for those who only want to use the blog feature of Docusaurus. 문서 전용 모드와 비슷한 방법을 적용합니다. Follow the setup instructions on Blog-only mode.