Creating your site
Docusaurus 旨在让您的开源项目创建文档和网站变得更简单。
在 installation 和 preparation 之后,为您的文档创建基础站点的工作大部分已完成。
站点结构
您的网站结构如下所示:
root-of-repo
├── docs
└── website
│ └── blog
│ └── core
│ └── Footer.js
│ └── node_modules
│ └── package.json
│ └── pages
│ └── sidebars.json
│ └── siteConfig.js
│ └── static
假设你删除了由 初始化 脚本所创建的示例
.md
文件。
All of your documentation files should be placed inside the docs
folder as markdown .md
files. Any blog posts should be inside the blog
folder.
博客的文章格式应统一为
YYYY-MM-DD-your-file-name.md
创建您的基础站点
创建一个功能齐备的网站,你只需要以下几步:
Add your documentation to the
/docs
folder as.md
files, ensuring you have the proper header in each file. The simplest header would be the following, whereid
is the link name (e.g.,docs/intro.html
) and thetitle
, is, of course, the title of the browser page.--- id: intro title: Getting Started --- My *new content* here..
Add zero or more docs to the
sidebars.json
file so that your documentation is rendered in a sidebar, if you choose them to be.If you do not add your documentation to the
sidebars.json
file, the docs will be rendered, but they can only be linked to from other documentation and visited with the known URL.Modify the
website/siteConfig.js
file to configure your site, following the comments included in the docs and thewebsite/siteConfig.js
to guide you.Create any custom pages and/or customize the
website/core/Footer.js
file that provides the footer for your site.Place assets, such as images, in the
website/static/
folder.Run the site to see the results of your changes.
cd website yarn run start # or `npm run start` # navigate to http://localhost:3000