diff options
| author | Fuwn <[email protected]> | 2021-04-06 20:11:26 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-04-06 20:11:26 -0700 |
| commit | 6e04b1bab644045398b213900b60bf1ac1c0272d (patch) | |
| tree | 0cc17281bbd67244efc3c23e71297c9cbaa9c0d8 /docs/tutorial/create-a-page.md | |
| parent | chore: Create contribution guidelines (diff) | |
| download | site-6e04b1bab644045398b213900b60bf1ac1c0272d.tar.xz site-6e04b1bab644045398b213900b60bf1ac1c0272d.zip | |
major: Furnish repository
Diffstat (limited to 'docs/tutorial/create-a-page.md')
| -rw-r--r-- | docs/tutorial/create-a-page.md | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/docs/tutorial/create-a-page.md b/docs/tutorial/create-a-page.md new file mode 100644 index 0000000..1056090 --- /dev/null +++ b/docs/tutorial/create-a-page.md @@ -0,0 +1,45 @@ +--- +title: Create a Page +--- + +Any React or Markdown file created under `src/pages` directory is converted into a website page: + +- `src/pages/index.js` -> `localhost:3000/` +- `src/pages/foo.md` -> `localhost:3000/foo` +- `src/pages/foo/bar.js` -> `localhost:3000/foo/bar` + +## Create a React Page + +Create a file at `src/pages/my-react-page.js`: + +```jsx title="src/pages/my-react-page.js" +import React from 'react'; +import Layout from '@theme/Layout'; + +function HelloWorld() { + return ( + <Layout> + <h1>My React page</h1> + <p>This is a React page</p> + </Layout> + ); +} +``` + +A new page is now available at `http://localhost:3000/my-react-page`. + +## Create a Markdown Page + +Create a file at `src/pages/my-markdown-page.md`: + +```mdx title="src/pages/my-markdown-page.md" +--- +title: My Markdown page +--- + +# My Markdown page + +This is a Markdown page +``` + +A new page is now available at `http://localhost:3000/my-markdown-page`. |