欢迎来到我的网站
Create a doc
Create a Markdown file, greeting.md, and place it under the docs directory.
内容如下:
---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 timesDoc 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.
(大致意思: 首页(front matter)是可选项, Docusaurus可以在没有首页的情况下,根据doc内容推断出一些信息,比如文章标题可以将文章第一个#作为标题)
Doc tags
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-tagstitle: A doc with tagstags: - Demo - Getting started---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 # 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. 方式如下:
---id: part1---
Lorem ipsum此时访问地址就就变成id了.
Doc URLs
默认情况下,文档的URL位置是相对于docs文件夹的文件路径,只有少数例外。也就是说,如果一个文件被命名如下,文件名将不包含在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
在所有情况下,默认的slug只有/Guides,没有/index、/README或重复的/Guides段。
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.mdBy default hello.md will be available at /docs/guide/hello. You can change its URL location to /docs/bonjour:
---slug: /bonjour---
Lorem ipsum此时要访问guide/hello.md文件,url变成localhost/bonjour , 如果 slug: myhello , 则路径为/guide/myhello
Sidebars
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.