Menu

Layouts & Pages

Here’s a well-structured Layouts & Pages section that matches the tone and format of your other Docsta documentation content:

Docsta gives you a clean, component-based layout system that’s easy to customize and scale. With a focus on reusability and modularity, you can design your documentation experience exactly the way you want—from the global layout to individual pages.

1. Global Layout

All pages in Docsta typically wrap within a global layout component, which provides a consistent structure including:

  • Sidebar navigation
  • Top header (optional)
  • Content area
  • Footer (optional)

This layout file is usually located in:

components/
└── Layout.tsx

You can customize this component to match your brand, theme, or content structure.

Example Layout Usage:

// app/layout.tsx (App Router)
import Layout from '@/components/Layout'

export default function RootLayout({ children }) {
return (
<html>
<body>
<Layout>{children}</Layout>
</body>
</html>
)
}
2. Documentation Pages

Each documentation page is rendered based on a dynamic route and typically powered by content fetched from Sanity or written in MDX.

  • Sanity Example: Fetch and render content using Portable Text
  • MDX Example: Use next-mdx-remote or @next/mdx to render markdown content

Page logic is usually handled in:

app/docs/[slug]/page.tsx

Or:

pages/docs/[slug].tsx

3. Custom Pages

Need to add pages like Changelog, FAQs, or About? You can create them as static routes:

app/
└── changelog/
└── page.tsx

or

pages/
└── changelog.tsx

These can still use the same layout and component system for consistency.

4. Content Rendering

If using Sanity, your layout may include a renderer like:

import { PortableText } from '@portabletext/react'
<PortableText value={doc.content} />

If using MDX, the layout may include:

import { MDXRemote } from 'next-mdx-remote'
<MDXRemote {...mdxSource} />
5. SEO-Friendly Metadata

Each page can define its own title, description, and Open Graph metadata using Next.js metadata exports or <Head> component.

export const metadata = {
title: 'Installation – Docsta Docs',
description: 'How to install Docsta in your Next.js project',
}

With Docsta’s flexible layouts and clean page architecture, you have full control over your documentation experience—from structure to style.

👉 Next Up: Learn how to write and structure content using MDX or manage it visually with Sanity Studio.

What did you think of this content?

like-icon

It was helpful

dislike-icon

It was not helpful

feedback-icon

I have a feedback