GitHub|Since 2007
Step 14

Navigation and Layout

Complete your site by building a persistent Header and Footer that stays visible across all pages.

14 min

Building a Unified Layout

The `layout.tsx` file in the root of your `app` folder acts as a wrapper for every page. This is the perfect place for your Navigation bar and Footer.

1. Create the Header Component

import Link from 'next/link';

export default function Header() {
  return (
    <nav className="border-b py-6">
      <div className="container mx-auto flex justify-between">
        <Link href="/" className="text-xl font-bold">NextWP</Link>
        <div className="space-x-4">
          <Link href="/">Home</Link>
          <Link href="/blog">Blog</Link>
        </div>
      </div>
    </nav>
  );
}

2. Update Root Layout

Import your Header into `app/layout.tsx` and place it above the `{children}` prop. Now, your navigation will persist instantly as you click through pages without reloading the entire UI.

Comments and Discussion