Adding Pages
How to add new pages to your DirectoryKit directory.
Route groups
DirectoryKit organizes pages into route groups. Choose the right group for your new page:
| Group | Use for | Layout |
|---|---|---|
(marketing) | Public pages | Header + Footer + AdBanner |
(dashboard) | Auth-required pages | Dashboard layout |
(admin) | Admin pages | Admin sidebar layout |
1. Create the route
Create a new directory under app/(marketing)/:
app/(marketing)/my-page/page.tsx
2. Write the component
import type { Metadata } from 'next'
export const metadata: Metadata = {
title: 'My Page — My Directory',
description: 'Description for SEO.',
}
export default function MyPage() {
return (
<div className="mx-auto max-w-4xl px-6 py-16">
<h1 className="text-3xl font-bold">My Page</h1>
<p className="mt-4 text-muted-foreground">
Your content here.
</p>
</div>
)
}3. Add navigation
To add a link in the header, edit components/layout/Header.tsx and add your page to the navigation array.
Protected pages
For pages that require authentication, use requireAuth():
import { requireAuth } from '@/lib/supabase/auth-helpers'
export default async function ProtectedPage() {
const redirect = await requireAuth()
if (redirect) return redirect
return <div>Protected content</div>
}