Site Preparation
After installing Docusaurus, you will want to install and run the example site included. This serves dual purposes.
- Verifying that Docusaurus was installed correctly.
- Providing you the skeleton to create your site.
Verifying Installation
Generate the files for the example site by running
examples
usingyarn
ornpm
.npm run examples
or
yarn run examples
If any of the files created by
[yarn | npm] run examples
already exists, Docusaurus will not overwrite them.Run the server.
npm run start
or
yarn run start
Load the example site at http://localhost:3000. You should see the example site loaded in your web browser.
Example Site Configuration
Loading the example site will create the following files/folders:
website/core/Footer.js
website/pages/...
website/static/img/...
website/siteConfig.js
website/blog-examples-from-docusaurus/...
docs-examples-from-docusaurus/...
The
docs-examples-from-docusaurus
folder will be at the same directory level aswebsite
, not in it.
The provided example files contain configurations that can be used as starting points for your site:
- The
website/core/Footer.js
file is a React component that acts as the footer for the site generated by Docusaurus and should be customized by the user. - The
website/blog-examples-from-docusaurus
folder contains examples of blog posts written in markdown. - The
docs-examples-from-docusaurus
folder contains example documentation files written in markdown. - The
website/pages
folder contains example top-level pages for the site. - The
website/static
folder contains static assets used by the example site. - The
website/siteConfig.js
file is the main configuration file used by Docusaurus.
You will need to keep the website/siteConfig.js
and website/core/Footer.js
files, but may edit them as you wish.
You should keep the website/pages
and website/static
folders, but may change the content inside them as you wish. At the bare minimum you should have an en/index.js
or en/index.html
file inside website/pages
and an image to use as your header icon inside website/static
.
The website/blog-examples-from-docusaurus
and docs-examples-from-docusaurus
folders contain example blog and document markdown files. If you wish to run Docusaurus with these files, you need to rename the folders to website/blog
and docs
, respectively.