create-a-page.mdx 1015 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ---
  2. sidebar_position: 1
  3. ---
  4. # Create a Page
  5. Add **Markdown or React** files to `src/pages` to create a **standalone page**:
  6. - `src/pages/index.js` → `localhost:3000/`
  7. - `src/pages/foo.md` → `localhost:3000/foo`
  8. - `src/pages/foo/bar.js` → `localhost:3000/foo/bar`
  9. ## Create your first React Page
  10. Create a file at `src/pages/my-react-page.js`:
  11. ```jsx title="src/pages/my-react-page.js"
  12. import React from 'react';
  13. import Layout from '@theme/Layout';
  14. export default function MyReactPage() {
  15. return (
  16. <Layout>
  17. <h1>My React page</h1>
  18. <p>This is a React page</p>
  19. </Layout>
  20. );
  21. }
  22. ```
  23. A new page is now available at [http://localhost:3000/my-react-page](http://localhost:3000/my-react-page).
  24. ## Create your first Markdown Page
  25. Create a file at `src/pages/my-markdown-page.md`:
  26. ```mdx title="src/pages/my-markdown-page.md"
  27. # My Markdown page
  28. This is a Markdown page
  29. ```
  30. A new page is now available at [http://localhost:3000/my-markdown-page](http://localhost:3000/my-markdown-page).