--- title: Pages and Layouts description: Create your first page and shared layout with the Pages Router. --- The Pages Router has a file-system based router built on the concept of pages. When a file is added to the `pages` directory, it's automatically available as a route. In Next.js, a **page** is a [React Component](https://react.dev/learn/your-first-component) exported from a `.js`, `.jsx`, `.ts`, or `.tsx` file in the `pages` directory. Each page is associated with a route based on its file name. **Example**: If you create `pages/about.js` that exports a React component like below, it will be accessible at `/about`. ```jsx export default function About() { return
About
} ``` ## Index routes The router will automatically route files named `index` to the root of the directory. - `pages/index.js` → `/` - `pages/blog/index.js` → `/blog` ## Nested routes The router supports nested files. If you create a nested folder structure, files will automatically be routed in the same way still. - `pages/blog/first-post.js` → `/blog/first-post` - `pages/dashboard/settings/username.js` → `/dashboard/settings/username` ## Pages with Dynamic Routes Next.js supports pages with dynamic routes. For example, if you create a file called `pages/posts/[id].js`, then it will be accessible at `posts/1`, `posts/2`, etc. > To learn more about dynamic routing, check the [Dynamic Routing documentation](/docs/pages/building-your-application/routing/dynamic-routes). ## Layout Pattern The React model allows us to deconstruct a [page](/docs/pages/building-your-application/routing/pages-and-layouts) into a series of components. Many of these components are often reused between pages. For example, you might have the same navigation bar and footer on every page. ```jsx filename="components/layout.js" import Navbar from './navbar' import Footer from './footer' export default function Layout({ children }) { return ( <>
{children}