2019-04-23 12:44:37 -04:00
---
id: tutorial-create-pages
title: Create Pages
---
2019-05-31 11:36:59 -04:00
In this section, we will learn about creating two types of pages in Docusaurus: a regular page and a documentation page.
2019-04-23 12:44:37 -04:00
2019-04-29 12:51:42 -04:00
< img alt = "Docusaurus MacBook" src = "/img/undraw_docusaurus_tree.svg" class = "docImage" / >
2019-04-23 12:44:37 -04:00
## Creating a Regular Page
1. Go into the `pages/en` directory and create a file called `hello-world.js` with the following contents:
```
const React = require('react');
const CompLibrary = require('../../core/CompLibrary.js');
const Container = CompLibrary.Container;
const GridBlock = CompLibrary.GridBlock;
function HelloWorld(props) {
return (
< div className = "docMainWrapper wrapper" >
< Container className = "mainContainer documentContainer postContainer" >
< h1 > Hello World!< / h1 >
< p > This is my first page!< / p >
< / Container >
< / div >
);
}
module.exports = HelloWorld;
```
2019-04-29 12:51:42 -04:00
2. Go to http://localhost:3000/hello-world and you should be able to see the new page.
2019-05-02 22:16:05 -04:00
1. Change the text within the `<p>...</p>` to "I can write JSX here!". The browser should refresh automatically to reflect the changes.
2019-04-23 12:44:37 -04:00
2019-04-29 12:51:42 -04:00
```diff
- < p > This is my first page!</ p >
2019-05-02 22:16:05 -04:00
+ < p > I can write JSX here!< / p >
2019-04-29 12:51:42 -04:00
```
2019-05-17 13:26:55 -04:00
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 ](custom-pages ).
2019-04-23 12:44:37 -04:00
2019-04-23 14:36:51 -04:00
< img alt = "Docusaurus React" src = "/img/undraw_docusaurus_react.svg" class = "docImage" / >
2019-04-23 12:44:37 -04:00
## Create a Documentation Page
2019-05-16 19:03:59 -04:00
1. Create a new file in the `docs` folder called `doc4.md` . The `docs` folder is in the root of your Docusaurus project, one level above `website` .
2019-04-23 12:44:37 -04:00
1. Paste the following contents:
```
---
2019-05-02 22:16:05 -04:00
id: doc4
title: This is Doc 4
2019-04-23 12:44:37 -04:00
---
2019-05-02 22:16:05 -04:00
I can write content using [GitHub-flavored Markdown syntax ](https://github.github.com/gfm/ ).
2019-04-23 12:44:37 -04:00
2019-05-02 22:16:05 -04:00
## Markdown Syntax
2019-04-23 12:44:37 -04:00
2019-05-02 22:16:05 -04:00
**Bold** _italic_ `code` [Links ](#url )
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
> id sem consectetuer libero luctus adipiscing.
* Hey
* Ho
* Let's Go
2019-04-23 12:44:37 -04:00
```
2019-05-31 11:36:59 -04:00
3. The `sidebars.json` is where you specify the order of your documentation pages, so open `website/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.
2019-04-23 12:44:37 -04:00
```diff
{
"docs": {
2019-04-29 12:51:42 -04:00
"Docusaurus": [
"doc1",
2019-05-02 22:16:05 -04:00
+ "doc4"
2019-04-29 12:51:42 -04:00
],
2019-04-23 12:44:37 -04:00
"First Category": ["doc2"],
"Second Category": ["doc3"]
},
"docs-other": {
"First Category": ["doc4", "doc5"]
}
}
```
2019-05-31 11:36:59 -04:00
4. A server restart is needed to pick up sidebar changes, so kill your dev server (< kbd > Cmd</ kbd > + < kbd > C</ kbd > or < kbd > Ctrl</ kbd > + < kbd > C</ kbd > ) and restart it with `npm run start` .
1. Navigate to http://localhost:3000/docs/doc4.
2019-04-23 12:44:37 -04:00
2019-05-31 11:36:59 -04:00
You've created your first documentation page on Docusaurus!
2019-04-23 12:44:37 -04:00
Learn more about creating docs pages [here ](navigation ).