Create Pages
In this section we will learn about creating two new 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:
@@ -103,9 +103,12 @@
module.exports = HelloWorld;
- Go to http://localhost:3000/hello-world (TODO) and you should be able to see the new page. +
- 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'm at F8!". The browser should refresh automatically to reflect the changes. - Go to
sidebars.json
and add"f8"
after"doc1"
.
+ - Go to
sidebars.json
and add"f8"
after"doc1"
. This ID should be the same one as in the Markdown file above. - Navigate to http://localhost:3000/docs/f8. (TODO) +
- Kill your webserver (Cmd + C or Ctrl + C) and restart it (with
npm run start
) because a server restart is needed for sidebar changes.
+ - Navigate to http://localhost:3000/docs/f8.
-
-
- <p>This is my first page!</p>
++ <p>I'm at F8!</p>
+
React is being used as a templating engine for rendering static markup. You can leverage on the expressability of React to build rich web content. Learn more about creating pages here.
@@ -125,12 +128,14 @@ Create a Documentation PageIn this session, we learned how Docusaurus makes it really simple to create a website for open source project documentation and get hands on by creating a Docusaurus website.
-
-
{
"docs": {
-+ "Docusaurus": ["doc1", "f8"],
-- "Docusaurus": ["doc1"],
+ "Docusaurus": [
+ "doc1",
++ "f8"
+ ],
"First Category": ["doc2"],
"Second Category": ["doc3"]
},
@@ -140,11 +145,12 @@
}
-
-
You've created your first documentation page on Docusaurus! The sidebars.json
is where you specify the order of your documentation pages and in the front matter of the Markdown file is where you provide metadata about that page.
Learn more about creating docs pages here.
-