Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,8 @@ coverage/
.jest/

._*.mdx
._*.md
._*.json
._*.ts
._*.tsx
out/
35 changes: 32 additions & 3 deletions app/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import type { Metadata } from 'next';
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
import { HomeLayout } from 'fumadocs-ui/layouts/home';
import { DocsPage, DocsBody } from 'fumadocs-ui/page';
import { notFound } from 'next/navigation';
import { source } from '@/lib/source';
import { generatePageMetadata, getCanonicalUrl } from '@/lib/seo-utils';
import { getFinalPageTitle } from '@/lib/h1-extractor';
import { readFile } from 'fs/promises';
import { getMDXComponents } from '@/mdx-components';
import { baseOptions } from '../layout.config';
import { homeOptions, docsOptions } from '../layout.config';
import { docs } from '@/.source/index';

export default async function Page({
params,
Expand All @@ -23,9 +25,25 @@ export default async function Page({

const MDX = page.data.body;

// Determine if this is the root page (no sidebar needed)
const isRootPage = !slug || slug.length === 0;

// Use HomeLayout for root page (no sidebar), DocsLayout for all other pages
if (isRootPage) {
return (
<HomeLayout {...homeOptions}>
<div className="container max-w-6xl mx-auto px-4 py-8">
<article className="prose prose-neutral dark:prose-invert max-w-none">
<MDX components={getMDXComponents()} />
</article>
</div>
</HomeLayout>
);
}

return (
<DocsLayout
{...baseOptions}
{...docsOptions}
tree={source.pageTree}
nav={{
title: 'DeployStack Docs',
Expand All @@ -45,7 +63,18 @@ export default async function Page({
}

export async function generateStaticParams() {
return source.generateParams();
const params = source.generateParams();

const result = [
...params,
...docs.docs
.filter((page: any) => page._file.flattenedPath)
.map((page: any) => ({
slug: page._file.flattenedPath.split('/'),
})),
];

return result;
}

export async function generateMetadata({
Expand Down
43 changes: 39 additions & 4 deletions app/layout.config.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,47 @@
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';

export const baseOptions: BaseLayoutProps = {
// Navigation bar configuration
// Base configuration shared between both layouts
const baseConfig = {
nav: {
title: 'DeployStack Docs',
url: '/',
},

// GitHub repository for edit links
githubUrl: 'https://github.com/deploystackio/documentation',
};

// Configuration for the home page (root URL) with all links visible
export const homeOptions: BaseLayoutProps = {
...baseConfig,
links: [
{
text: 'MCP Server',
url: 'https://deploystack.io/mcp',
external: true,
},
{
text: 'Changelog',
url: 'https://deploystack.io/changelog',
external: true,
},
{
type: 'custom',
secondary: true,
children: (
<a
href="https://cloud.deploystack.io/login"
target="_blank"
rel="noopener noreferrer"
className="text-slate-100 bg-slate-800 border border-slate-700 ml-1.5 focus:outline-none hover:bg-slate-900 hover:text-slate-50 focus:ring-4 focus:ring-gray-100 font-medium rounded-full text-sm px-5 py-2 me-2 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700 transition-colors"
>
Login
</a>
),
},
],
};

export const docsOptions: BaseLayoutProps = {
...baseConfig
};

export const baseOptions = docsOptions;
Loading
Loading