Skip to content

Commit ea889c3

Browse files
authored
Merge pull request #47 from objectstack-ai/copilot/update-fumadocs-template-again
2 parents c74b970 + 7b9043b commit ea889c3

File tree

24 files changed

+977
-658
lines changed

24 files changed

+977
-658
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
},
1818
"dependencies": {
1919
"client-only": "^0.0.1",
20-
"lucide-react": "^0.562.0",
21-
"react": "^19.2.3",
22-
"react-dom": "^19.2.3",
20+
"lucide-react": "^0.563.0",
21+
"react": "^19.2.4",
22+
"react-dom": "^19.2.4",
2323
"server-only": "^0.0.1",
2424
"tailwind-merge": "^3.4.0"
2525
},

packages/site/app/[lang]/docs/[[...slug]]/page.tsx

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,13 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
import { source } from '@/lib/source';
9+
import { getPageImage, source } from '@/lib/source';
10+
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/layouts/docs/page';
1011
import type { Metadata } from 'next';
11-
import { DocsPage, DocsBody } from 'fumadocs-ui/page';
1212
import { notFound } from 'next/navigation';
13+
import { getMDXComponents } from '@/mdx-components';
14+
import { createRelativeLink } from 'fumadocs-ui/mdx';
1315
import { siteConfig } from '@/lib/site-config';
14-
import defaultComponents from 'fumadocs-ui/mdx';
15-
import { Callout } from 'fumadocs-ui/components/callout';
16-
import { Card, Cards } from 'fumadocs-ui/components/card';
17-
import { Steps, Step } from 'fumadocs-ui/components/steps';
18-
19-
const components = {
20-
...defaultComponents,
21-
Callout,
22-
Card,
23-
Cards,
24-
Steps,
25-
Step,
26-
};
2716

2817
interface PageProps {
2918
params: Promise<{
@@ -41,26 +30,25 @@ export default async function Page({ params }: PageProps) {
4130
notFound();
4231
}
4332

44-
const MDX = page.data.body as any;
33+
const MDX = page.data.body;
4534

4635
return (
47-
<DocsPage
48-
toc={page.data.toc as any}
49-
full={page.data.full as any}
50-
lastUpdate={siteConfig.page.showLastUpdate ? (page.data as any).lastModified : undefined}
36+
<DocsPage
37+
toc={page.data.toc}
38+
full={page.data.full}
5139
tableOfContent={{
5240
enabled: siteConfig.layout.toc.enabled,
5341
style: siteConfig.layout.toc.depth > 2 ? 'clerk' : 'normal',
5442
}}
55-
editOnGithub={siteConfig.page.showEditLink ? {
56-
owner: siteConfig.page.repoBaseUrl.split('/')[3],
57-
repo: siteConfig.page.repoBaseUrl.split('/')[4],
58-
sha: 'main', // Defaulting to main, could be extracted
59-
path: siteConfig.page.repoBaseUrl.split('/').slice(7).join('/') // simplistic parsing
60-
} : undefined}
6143
>
44+
<DocsTitle>{page.data.title}</DocsTitle>
45+
<DocsDescription>{page.data.description}</DocsDescription>
6246
<DocsBody>
63-
<MDX components={components} />
47+
<MDX
48+
components={getMDXComponents({
49+
a: createRelativeLink(source, page),
50+
})}
51+
/>
6452
</DocsBody>
6553
</DocsPage>
6654
);
@@ -80,5 +68,8 @@ export async function generateMetadata({ params }: PageProps): Promise<Metadata>
8068
return {
8169
title: page.data.title,
8270
description: page.data.description,
71+
openGraph: {
72+
images: getPageImage(page).url,
73+
},
8374
};
8475
}

packages/site/app/[lang]/docs/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import { source } from '@/lib/source';
1010
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
1111
import type { ReactNode } from 'react';
12-
import { baseOptions } from '@/app/layout.config';
12+
import { baseOptions } from '@/lib/layout.shared';
1313
import { siteConfig } from '@/lib/site-config';
1414

1515
export default async function Layout({
@@ -24,7 +24,7 @@ export default async function Layout({
2424
return (
2525
<DocsLayout
2626
tree={source.getPageTree(lang)}
27-
{...baseOptions}
27+
{...baseOptions()}
2828
sidebar={{
2929
enabled: siteConfig.layout.sidebar.enabled,
3030
prefetch: siteConfig.layout.sidebar.prefetch,

packages/site/app/[lang]/layout.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,18 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
import 'fumadocs-ui/style.css';
109
import { RootProvider } from 'fumadocs-ui/provider/next';
1110
import { defineI18nUI } from 'fumadocs-ui/i18n';
1211
import { i18n } from '@/lib/i18n';
1312
import { getTranslations } from '@/lib/translations';
1413

15-
1614
const { provider } = defineI18nUI(i18n, {
1715
translations: getTranslations(),
1816
});
1917

2018
export default async function Layout({ params, children }: LayoutProps<'/[lang]'>) {
2119
const { lang } = await params;
2220
return (
23-
<html lang={lang} suppressHydrationWarning>
24-
<body
25-
style={{
26-
display: 'flex',
27-
flexDirection: 'column',
28-
minHeight: '100vh',
29-
}}
30-
>
31-
<RootProvider i18n={provider(lang)}>{children}</RootProvider>
32-
</body>
33-
</html>
21+
<RootProvider i18n={provider(lang)}>{children}</RootProvider>
3422
);
3523
}

packages/site/app/api/search/route.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77
*/
88

99
import { source } from '@/lib/source';
10-
import { createSearchAPI } from 'fumadocs-core/search/server';
10+
import { createFromSource } from 'fumadocs-core/search/server';
1111

12-
export const { GET } = createSearchAPI('advanced', {
13-
indexes: source.getPages().map((page) => ({
14-
title: page.data.title,
15-
description: page.data.description,
16-
url: page.url,
17-
id: page.url,
18-
structuredData: page.data.structuredData,
19-
})),
12+
export const { GET } = createFromSource(source, {
13+
localeMap: {
14+
en: 'english',
15+
// Map 'cn' locale to English tokenizer since Chinese is not supported by Orama
16+
cn: 'english',
17+
},
2018
});

packages/site/app/global.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@import 'tailwindcss';
2+
@import 'fumadocs-ui/css/neutral.css';
3+
@import 'fumadocs-ui/css/preset.css';

packages/site/app/layout.config.tsx

Lines changed: 0 additions & 49 deletions
This file was deleted.

packages/site/app/layout.tsx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,12 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
import 'fumadocs-ui/style.css';
10-
import { RootProvider } from 'fumadocs-ui/provider/next';
11-
import { defineI18nUI } from 'fumadocs-ui/i18n';
12-
import { i18n } from '@/lib/i18n';
13-
import { getTranslations } from '@/lib/translations';
14-
15-
16-
const { provider } = defineI18nUI(i18n, {
17-
translations: getTranslations(),
18-
});
9+
import './global.css';
1910

2011
export default function Layout({ children }: { children: React.ReactNode }) {
2112
return (
2213
<html lang="en" suppressHydrationWarning>
23-
<body
24-
style={{
25-
display: 'flex',
26-
flexDirection: 'column',
27-
minHeight: '100vh',
28-
}}
29-
>
14+
<body className="flex flex-col min-h-screen">
3015
{children}
3116
</body>
3217
</html>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* ObjectDocs
3+
* Copyright (c) 2026-present ObjectStack Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
import { getLLMText, source } from '@/lib/source';
10+
11+
export const revalidate = false;
12+
13+
export async function GET() {
14+
const scan = source.getPages().map(getLLMText);
15+
const scanned = await Promise.all(scan);
16+
17+
return new Response(scanned.join('\n\n'));
18+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* ObjectDocs
3+
* Copyright (c) 2026-present ObjectStack Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
import { getLLMText, source } from '@/lib/source';
10+
import { notFound } from 'next/navigation';
11+
12+
export const revalidate = false;
13+
14+
export async function GET(_req: Request, { params }: RouteContext<'/llms.mdx/docs/[[...slug]]'>) {
15+
const { slug } = await params;
16+
const page = source.getPage(slug);
17+
if (!page) notFound();
18+
19+
return new Response(await getLLMText(page), {
20+
headers: {
21+
'Content-Type': 'text/markdown',
22+
},
23+
});
24+
}
25+
26+
export function generateStaticParams() {
27+
return source.generateParams();
28+
}

0 commit comments

Comments
 (0)