* Complete function Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * A lot of blank lines Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * More lenient validation Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Remove or Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Simpler logic Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Expand docs Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Better docs Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Dogfood Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * More writeup Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Polish Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Polish Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Move mergeAuthorMap to authors.ts Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Unbreak relative assets * Update docs * Clarify in docs * simplify feed authors * rename authorMap -> authorsMap * mergeAuthorsMap -> getBlogPostAuthors * website => 5 blog posts per page * improve authors map file * Extract new theme authors components + display in row * add comment for meta array syntaxes * blog => getPathsToWatch should watch authorsMap file * remove useless v1 blog FBID frontmatter * keep older frontmatter syntax for now * revert blog frontmatter * Better console message * better blog authors frontmatter impl * add multi authors to beta blog post + fix some authors margins * fix React key * Refactor: mdx loader should support a more flexible assets system (poc, not documented yet) * better display of blog post authors: adapt layout to authors count + add line clamp * smaller local image * fix blog feed tests * fix blog frontmatter tests + improve validation schema * add more frontmatter tests * add tests for getAuthorsMapFilePath * tests for validateAuthorsMapFile * add tests for readAuthorsMapFile * test getAuthorsMap * exhaustive tests for getBlogPostAuthors * fix remaining tests * missing blog plugin author tests * fix windows tests * improve blog multi-author's doc * Use new format in init template Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Improve error message Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * update feed snapshot * blog authors: limit to 2 cols + fix margins for no authors * minor doc improvements * better init template blog posts, demonstrating Blog features * replace the legacy blog author frontmatter in remaining places * Prefer using clsx Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * cleanup getColClassName * remove blog author name/title line-clamping Co-authored-by: slorber <lorber.sebastien@gmail.com>
2.2 KiB
id | title | sidebar_label | slug |
---|---|---|---|
introduction | Docs Introduction | Introduction | /docs-introduction |
The docs feature provides users with a way to organize Markdown files in a hierarchical format.
:::info
Check the Docs Plugin API Reference documentation for an exhaustive list of options.
:::
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, greeting.md
id is greeting
and guide/hello.md
id 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 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
If you want more control over the last part of the document URL, it is possible to add a slug
(defaults to the id
).
---
id: part1
slug: part1.html
---
Lorem ipsum
:::note
It is possible to use:
- absolute slugs:
slug: /mySlug
,slug: /
... - relative slugs:
slug: mySlug
,slug: ./../mySlug
...
:::
Home page docs
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 frontmatter:
---
id: my-home-doc
slug: /
---
Lorem ipsum
Docs-only mode
If you only want the documentation feature, you can run your Docusaurus 2 site without a landing page and display your documentation page as the index page instead.
To enable docs-only mode, set the docs plugin routeBasePath: '/'
, and use the frontmatter slug: /
on the document that should be the index page (more info).
:::caution
You should delete the existing homepage at ./src/pages/index.js
, or else there will be two files mapping to the same route!
:::
:::tip
There's also a "blog-only mode" for those who only want to use the blog feature of Docusaurus 2. You can use the same method detailed above. Follow the setup instructions on Blog-only mode.
:::