Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
feat(docs): add PageActions and .md support to all sections
- Add PageActions to createDocsPage (fixes tool-router, examples) - Add PageActions to reference pages - Add .md routes for tool-router, examples, reference - Extend rewrites to support all sections including index pages Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sushmithamallesh committed
Jan 19, 2026 at 15:20 UTC
9b076b0ec83405d35b4d1f764087ad6e3b52e53e
6 files changed
+99
-11
docs/app/(home)/reference/[[...slug]]/page.tsx
+3
-1
@@ -12,6 +12,7 @@ import { getMDXComponents } from '@/mdx-components';
12
import type { Metadata } from 'next';
13
import { createRelativeLink } from 'fumadocs-ui/mdx';
14
import type { ApiPageProps } from 'fumadocs-openapi/ui';
15
+import { PageActions } from '@/components/page-actions';
16
17
interface OpenAPIPageData {
18
title: string;
@@ -49,7 +50,8 @@ export default async function Page({
50
return (
51
<DocsPage toc={mdxData.toc} full={mdxData.full} footer={{ enabled: false }} tableOfContentPopover={{ enabled: false }}>
52
<DocsTitle>{mdxData.title}</DocsTitle>
52
- <DocsDescription>{mdxData.description}</DocsDescription>
53
+ <DocsDescription className="mb-2">{mdxData.description}</DocsDescription>
54
+ <PageActions path={page.url} />
55
<DocsBody>
56
<MDX
57
components={getMDXComponents({
docs/app/llms.mdx/examples/[[...slug]]/route.ts
new
+24
@@ -0,0 +1,24 @@
1
+import { examplesSource } from '@/lib/source';
2
+import { getLLMText } from '@/lib/source';
3
+import { notFound } from 'next/navigation';
4
+
5
+export const revalidate = false;
6
+
7
+export async function GET(
8
+ _req: Request,
9
+ { params }: { params: Promise<{ slug?: string[] }> }
10
+) {
11
+ const { slug } = await params;
12
+ const page = examplesSource.getPage(slug);
13
+ if (!page) notFound();
14
+
15
+ return new Response(await getLLMText(page), {
16
+ headers: {
17
+ 'Content-Type': 'text/markdown; charset=utf-8',
18
+ },
19
+ });
20
+}
21
+
22
+export function generateStaticParams() {
23
+ return examplesSource.generateParams();
24
+}
docs/app/llms.mdx/reference/[[...slug]]/route.ts
new
+24
@@ -0,0 +1,24 @@
1
+import { referenceSource } from '@/lib/source';
2
+import { getLLMText } from '@/lib/source';
3
+import { notFound } from 'next/navigation';
4
+
5
+export const revalidate = false;
6
+
7
+export async function GET(
8
+ _req: Request,
9
+ { params }: { params: Promise<{ slug?: string[] }> }
10
+) {
11
+ const { slug } = await params;
12
+ const page = referenceSource.getPage(slug);
13
+ if (!page) notFound();
14
+
15
+ return new Response(await getLLMText(page), {
16
+ headers: {
17
+ 'Content-Type': 'text/markdown; charset=utf-8',
18
+ },
19
+ });
20
+}
21
+
22
+export function generateStaticParams() {
23
+ return referenceSource.generateParams();
24
+}
docs/app/llms.mdx/tool-router/[[...slug]]/route.ts
new
+24
@@ -0,0 +1,24 @@
1
+import { toolRouterSource } from '@/lib/source';
2
+import { getLLMText } from '@/lib/source';
3
+import { notFound } from 'next/navigation';
4
+
5
+export const revalidate = false;
6
+
7
+export async function GET(
8
+ _req: Request,
9
+ { params }: { params: Promise<{ slug?: string[] }> }
10
+) {
11
+ const { slug } = await params;
12
+ const page = toolRouterSource.getPage(slug);
13
+ if (!page) notFound();
14
+
15
+ return new Response(await getLLMText(page), {
16
+ headers: {
17
+ 'Content-Type': 'text/markdown; charset=utf-8',
18
+ },
19
+ });
20
+}
21
+
22
+export function generateStaticParams() {
23
+ return toolRouterSource.generateParams();
24
+}
docs/lib/create-docs-page.tsx
+3
-1
@@ -8,6 +8,7 @@ import { notFound } from 'next/navigation';
8
import { getMDXComponents } from '@/mdx-components';
9
import type { Metadata } from 'next';
10
import { createRelativeLink } from 'fumadocs-ui/mdx';
11
+import { PageActions } from '@/components/page-actions';
12
13
// eslint-disable-next-line @typescript-eslint/no-explicit-any
14
type Source = any;
@@ -23,7 +24,8 @@ export function createDocsPage(source: Source) {
24
return (
25
<DocsPage toc={page.data.toc} full={page.data.full} footer={{ enabled: false }} tableOfContentPopover={{ enabled: false }}>
26
<DocsTitle>{page.data.title}</DocsTitle>
26
- <DocsDescription>{page.data.description}</DocsDescription>
27
+ <DocsDescription className="mb-2">{page.data.description}</DocsDescription>
28
+ <PageActions path={page.url} />
29
<DocsBody>
30
<MDX
31
components={getMDXComponents({
docs/next.config.mjs
+21
-9
@@ -13,15 +13,27 @@ const config = {
13
},
14
async rewrites() {
15
return [
16
- // Support both .md and .mdx extensions for AI agents
17
- {
18
- source: '/docs/:path*.mdx',
19
- destination: '/llms.mdx/docs/:path*',
20
- },
21
- {
22
- source: '/docs/:path*.md',
23
- destination: '/llms.mdx/docs/:path*',
24
- },
16
+ // Support .md and .mdx extensions for AI agents across all sections
17
+ // Docs
18
+ { source: '/docs/:path*.mdx', destination: '/llms.mdx/docs/:path*' },
19
+ { source: '/docs/:path*.md', destination: '/llms.mdx/docs/:path*' },
20
+ { source: '/docs.md', destination: '/llms.mdx/docs' },
21
+ { source: '/docs.mdx', destination: '/llms.mdx/docs' },
22
+ // Tool Router
23
+ { source: '/tool-router/:path*.mdx', destination: '/llms.mdx/tool-router/:path*' },
24
+ { source: '/tool-router/:path*.md', destination: '/llms.mdx/tool-router/:path*' },
25
+ { source: '/tool-router.md', destination: '/llms.mdx/tool-router' },
26
+ { source: '/tool-router.mdx', destination: '/llms.mdx/tool-router' },
27
+ // Examples
28
+ { source: '/examples/:path*.mdx', destination: '/llms.mdx/examples/:path*' },
29
+ { source: '/examples/:path*.md', destination: '/llms.mdx/examples/:path*' },
30
+ { source: '/examples.md', destination: '/llms.mdx/examples' },
31
+ { source: '/examples.mdx', destination: '/llms.mdx/examples' },
32
+ // Reference
33
+ { source: '/reference/:path*.mdx', destination: '/llms.mdx/reference/:path*' },
34
+ { source: '/reference/:path*.md', destination: '/llms.mdx/reference/:path*' },
35
+ { source: '/reference.md', destination: '/llms.mdx/reference' },
36
+ { source: '/reference.mdx', destination: '/llms.mdx/reference' },
37
];
38
},
39
async redirects() {