Skip to main content

Creating Pages

In this section, we will explore how to create standalone pages in a CodeHarborHub-powered Docusaurus site.

The @docusaurus/plugin-content-pages plugin allows you to build one-off pages like a custom landing page, a showcase, or a support page.
Pages can be created using React components or Markdown/MDX files.

note

Unlike Docs, Pages do not have sidebars by default.

info

Refer to the Pages Plugin API Reference for an exhaustive list of configuration options.

Add a React Page​

Pages in CodeHarborHub are React components.
You can leverage the power of React to create interactive, dynamic content.

Create a file /src/pages/helloReact.js:

/src/pages/helloReact.js
import React from 'react';
import Layout from '@theme/Layout';

export default function HelloReact() {
return (
<Layout title="Hello React" description="A simple React page">
<div
style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
height: '50vh',
fontSize: '20px',
}}
>
<p>
Edit <code>pages/helloReact.js</code> and save to reload.
</p>
</div>
</Layout>
);
}

After saving the file, open http://localhost:3000/helloReact to view your new page.

Add a Markdown Page​

You can also create static pages using Markdown or MDX.

Create a file /src/pages/helloMarkdown.md:

/src/pages/helloMarkdown.md
---
title: Hello Markdown
description: A simple Markdown page
hide_table_of_contents: true
---

# Hello from Markdown

This page was written entirely in Markdown.

Visit http://localhost:3000/helloMarkdown to see the result.

Routing​

Routing in CodeHarborHub follows the file system hierarchy inside /src/pages/. Each file automatically maps to a URL:

File pathURL Route
/src/pages/index.js[baseUrl]
/src/pages/about.js[baseUrl]/about
/src/pages/blog/index.js[baseUrl]/blog/
/src/pages/blog/post.js[baseUrl]/blog/post

You can also create nested directories for better organization.

Example directory structure:

my-website
└── src
└── pages
β”œβ”€β”€ index.js
β”œβ”€β”€ about.js
β”œβ”€β”€ support/
β”‚ β”œβ”€β”€ index.js
β”‚ └── styles.module.css
└── blog/
└── post.js

You can group page-related files (JSX/TSX, CSS modules, images) inside a dedicated folder for easier maintenance.

Example:

src/pages/support/
β”œβ”€β”€ index.js
└── styles.module.css

Then, import the CSS module inside index.js:

import styles from './styles.module.css';

This keeps styles scoped to the page.

Handling Duplicate Routes​

Creating two pages with the same route will trigger a warning during npm run start or npm run build. The last-created page overrides the others.

To avoid conflicts:

  • Rename one of the files, or
  • Update the onDuplicateRoutes option to customize behavior.

With React and Markdown pages, CodeHarborHub lets you build everything from simple static pages to fully interactive app-like experiences.