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
25 changes: 19 additions & 6 deletions apps/web/app/(docs)/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { Metadata } from 'next'
import { notFound } from 'next/navigation'
import { docsSource } from '@/lib/source'
import {
type DocsAudience,
getVisibleDocsPage,
getVisibleDocsParams,
} from '@/lib/source'
import 'rehype-callouts/theme/github'
import { FlaskConicalIcon, TriangleDashedIcon } from 'lucide-react'
import Link from 'next/link'
Expand All @@ -15,7 +19,7 @@ export async function generateMetadata({
params: Promise<{ slug?: string[] }>
}): Promise<Metadata> {
const slug = (await params).slug || []
const page = docsSource.getPage(slug)
const page = getVisibleDocsPage(slug)

if (!page) {
return {}
Expand All @@ -26,6 +30,7 @@ export async function generateMetadata({
summary: string
section: string
badge?: 'alpha' | 'beta'
audience: DocsAudience
image?: string
body: React.ComponentType
toc: unknown
Expand Down Expand Up @@ -57,6 +62,16 @@ export async function generateMetadata({
return {
title: pageTitle,
description: metadata.summary,
robots:
metadata.audience === 'private'
? {
index: false,
follow: false,
}
: undefined,
other: {
audience: metadata.audience,
},
openGraph: {
title: `${pageTitle} — bazza/ui`,
description: metadata.summary,
Expand Down Expand Up @@ -132,7 +147,7 @@ export default async function Page({
params: Promise<{ slug?: string[] }>
}) {
const slug = (await params).slug || []
const page = docsSource.getPage(slug)
const page = getVisibleDocsPage(slug)

if (!page) {
notFound()
Expand Down Expand Up @@ -179,9 +194,7 @@ export default async function Page({
}

export async function generateStaticParams() {
return docsSource.getPages().map((page) => ({
slug: page.slugs,
}))
return getVisibleDocsParams()
}

export const dynamicParams = false
9 changes: 8 additions & 1 deletion apps/web/app/(docs)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@ import {
SidebarProvider,
SidebarTrigger,
} from '@/components/ui/sidebar'
import { getVisibleDocsUrls, getVisiblePrivateDocsUrls } from '@/lib/source'

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode
}>) {
const visibleDocUrls = getVisibleDocsUrls()
const visiblePrivateDocUrls = getVisiblePrivateDocsUrls()

return (
<SidebarProvider className="h-svh min-h-0">
<AppSidebar />
<AppSidebar
visibleDocUrls={visibleDocUrls}
privateDocUrls={visiblePrivateDocUrls}
/>
<SidebarInset className="group lg:border-[0.5px] lg:border-border/75 overflow-y-auto scroll-py-6 sidebar-inset-scroll min-h-0 overscroll-none">
<div className="min-h-7 h-7 sticky left-4 top-4 ml-4">
<SidebarTrigger className="hidden group-data-[state=closed]/sidebar-wrapper:flex" />
Expand Down
6 changes: 3 additions & 3 deletions apps/web/app/llms.mdx/docs/[[...slug]]/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { notFound } from 'next/navigation'
import { docsSource } from '@/lib/source'
import { getVisibleDocsPage, getVisibleDocsParams } from '@/lib/source'

export const revalidate = false

Expand All @@ -8,7 +8,7 @@ export async function GET(
{ params }: { params: Promise<{ slug?: string[] }> },
) {
const { slug } = await params
const page = docsSource.getPage(slug ?? [])
const page = getVisibleDocsPage(slug ?? [])
if (!page) notFound()

// Get the raw MDX content using fumadocs getText API
Expand All @@ -22,5 +22,5 @@ export async function GET(
}

export function generateStaticParams() {
return docsSource.generateParams()
return getVisibleDocsParams()
}
Loading
Loading