File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { source } from '@/lib/source' ;
2+ import { readFile } from 'fs/promises' ;
3+ import { notFound } from 'next/navigation' ;
4+
5+ export const dynamic = 'force-static' ;
6+
7+ export async function GET (
8+ _req : Request ,
9+ { params } : { params : Promise < { slug ?: string [ ] } > } ,
10+ ) {
11+ const { slug } = await params ;
12+ const page = source . getPage ( slug ) ;
13+ if ( ! page || ! page . absolutePath ) notFound ( ) ;
14+
15+ const content = await readFile ( page . absolutePath , 'utf-8' ) ;
16+ return new Response ( content , {
17+ headers : { 'Content-Type' : 'text/plain; charset=utf-8' } ,
18+ } ) ;
19+ }
20+
21+ export async function generateStaticParams ( ) {
22+ return source . generateParams ( ) ;
23+ }
Original file line number Diff line number Diff line change 44 DocsDescription ,
55 DocsPage ,
66 DocsTitle ,
7+ ViewOptionsPopover ,
78} from 'fumadocs-ui/layouts/docs/page' ;
89import { notFound } from 'next/navigation' ;
910import { getMDXComponents } from '@/components/mdx' ;
@@ -23,9 +24,16 @@ export default async function Page(props: {
2324
2425 return (
2526 < DocsPage toc = { page . data . toc } full = { page . data . full } tableOfContent = { { style : 'clerk' } } >
26- < div className = "flex items-start justify-between gap-4 " >
27+ < div className = "flex flex-wrap items-start justify-between gap-2 " >
2728 < DocsTitle > { page . data . title } </ DocsTitle >
28- < VersionSelector />
29+ < div className = "flex items-center gap-2" >
30+ < ViewOptionsPopover
31+ className = "p-2 text-sm h-auto"
32+ markdownUrl = { `/docs-raw/${ ( params . slug ?? [ ] ) . join ( '/' ) } ` }
33+ githubUrl = { `https://github.com/29next/developer-docs/blob/main/content/docs/${ page . path } ` }
34+ />
35+ < VersionSelector />
36+ </ div >
2937 </ div >
3038 < DocsDescription > { page . data . description } </ DocsDescription >
3139 < DocsBody >
You can’t perform that action at this time.
0 commit comments