Version: 1.14.6
Create Pages
In this section, we will learn about creating two types of pages in Docusaurus: a regular page and a documentation page.
#
Creating a Regular Page- Go into the
pages/en
directory and create a file calledhello-world.js
with the following contents:
- Go to http://localhost:3000/hello-world and you should be able to see the new page.
- Change the text within the
<p>...</p>
to "I can write JSX here!". The browser should refresh automatically to reflect the changes.
React is being used as a templating engine for rendering static markup. You can leverage on the expressibility of React to build rich web content. Learn more about creating pages here.
#
Create a Documentation Page- Create a new file in the
docs
folder calleddoc4.md
. Thedocs
folder is in the root of your Docusaurus project, one level abovewebsite
. - Paste the following contents:
- The
sidebars.json
is where you specify the order of your documentation pages, so openwebsite/sidebars.json
and add"doc4"
after"doc1"
. This ID should be the same one as in the metadata for the Markdown file above, so if you gave a different ID in Step 2, just make sure to use the same ID in the sidebar file.
- A server restart is needed to pick up sidebar changes, so kill your dev server (Cmd + C or Ctrl + C) and restart it with
npm run start
. - Navigate to http://localhost:3000/docs/doc4.
You've created your first documentation page on Docusaurus!
Learn more about creating docs pages here.