2.5 KiB
| id | title |
|---|---|
| site-preparation | 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
examplesusingyarnornpm.npm run examplesor
yarn run examplesIf any of the files created by
[yarn | npm] run examplesalready exists, Docusaurus will not overwrite them. -
Run the server.
npm run startor
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-docusaurusfolder 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.jsfile 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-docusaurusfolder contains examples of blog posts written in markdown. - The
docs-examples-from-docusaurusfolder contains example documentation files written in markdown. - The
website/pagesfolder contains example top-level pages for the site. - The
website/staticfolder contains static assets used by the example site. - The
website/siteConfig.jsfile 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.