diff --git a/docs/.gitignore b/docs/.gitignore index e985853e..9d1387eb 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1 +1,30 @@ +# deps +node_modules + +# generated content +.source + +# test & build +coverage +.next/ +out/ +build +*.tsbuildinfo +dist + +# misc +.DS_Store +*.pem +.pnp +.pnp.js +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# others +.env*.local .vercel +next-env.d.ts + +# Turborepo +.turbo \ No newline at end of file diff --git a/docs/app/[lang]/(docs)/[[...slug]]/page.tsx b/docs/app/[lang]/(docs)/[[...slug]]/page.tsx new file mode 100644 index 00000000..5cf93f58 --- /dev/null +++ b/docs/app/[lang]/(docs)/[[...slug]]/page.tsx @@ -0,0 +1,88 @@ +import { createRelativeLink } from 'fumadocs-ui/mdx' +import type { Metadata } from 'next' +import { notFound } from 'next/navigation' +import { AskAI } from '@/components/geistdocs/ask-ai' +import { CopyPage } from '@/components/geistdocs/copy-page' +import { + DocsBody, + DocsDescription, + DocsPage, + DocsTitle, +} from '@/components/geistdocs/docs-page' +import { EditSource } from '@/components/geistdocs/edit-source' +import { Feedback } from '@/components/geistdocs/feedback' +import { getMDXComponents } from '@/components/geistdocs/mdx-components' +import { OpenInChat } from '@/components/geistdocs/open-in-chat' +import { ScrollTop } from '@/components/geistdocs/scroll-top' +import { Separator } from '@/components/ui/separator' +import { getLLMText, getPageImage, source } from '@/lib/geistdocs/source' + +const Page = async ({ params }: PageProps<'/[lang]/[[...slug]]'>) => { + const { slug, lang } = await params + const page = source.getPage(slug, lang) + + if (!page) { + notFound() + } + + const markdown = await getLLMText(page) + const MDX = page.data.body + + return ( + + + + + + + + + + ), + }} + toc={page.data.toc} + > + {page.data.title} + {page.data.description} + + + + + ) +} + +export const generateStaticParams = () => source.generateParams() + +export const generateMetadata = async ({ + params, +}: PageProps<'/[lang]/[[...slug]]'>) => { + const { slug, lang } = await params + const page = source.getPage(slug, lang) + + if (!page) { + notFound() + } + + const metadata: Metadata = { + title: page.data.title, + description: page.data.description, + openGraph: { + images: getPageImage(page).url, + }, + } + + return metadata +} + +export default Page diff --git a/docs/app/[lang]/(docs)/layout.tsx b/docs/app/[lang]/(docs)/layout.tsx new file mode 100644 index 00000000..d0084027 --- /dev/null +++ b/docs/app/[lang]/(docs)/layout.tsx @@ -0,0 +1,10 @@ +import { DocsLayout } from '@/components/geistdocs/docs-layout' +import { source } from '@/lib/geistdocs/source' + +const Layout = async ({ children, params }: LayoutProps<'/[lang]'>) => { + const { lang } = await params + + return {children} +} + +export default Layout diff --git a/docs/app/[lang]/layout.tsx b/docs/app/[lang]/layout.tsx new file mode 100644 index 00000000..19a94217 --- /dev/null +++ b/docs/app/[lang]/layout.tsx @@ -0,0 +1,29 @@ +import "../global.css"; +import { Footer } from "@/components/geistdocs/footer"; +import { Navbar } from "@/components/geistdocs/navbar"; +import { GeistdocsProvider } from "@/components/geistdocs/provider"; +import { basePath } from "@/geistdocs"; +import { mono, sans } from "@/lib/geistdocs/fonts"; +import { cn } from "@/lib/utils"; + +const Layout = async ({ children, params }: LayoutProps<"/[lang]">) => { + const { lang } = await params; + + return ( + + + + + {children} +