Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

docs: SEO improvements - OG images, robots.txt, and CLAUDE.md restructure (#2478)

Sushmitha Mallesh48f2698337c4
diff --git a/docs/.claude/context/fumadocs.md b/docs/.claude/context/fumadocs.md
new file mode 100644
index 000000000..068f2421f
--- /dev/null
+++ b/docs/.claude/context/fumadocs.md
@@ -0,0 +1,74 @@
+# Fumadocs Framework
+
+Composio docs is built with [Fumadocs](https://fumadocs.dev/), a Next.js-based documentation framework.
+
+## Key Files
+
+| File | Purpose |
+|------|---------|
+| `source.config.ts` | MDX collections and schema definitions |
+| `lib/source.ts` | Source loaders and utility functions |
+| `app/(home)/layout.tsx` | Home layout with navigation |
+| `app/docs/layout.tsx` | Docs layout with sidebar |
+| `app/global.css` | All custom styles and design tokens |
+| `mdx-components.tsx` | MDX component registration |
+
+## Design Tokens
+
+```css
+--composio-orange: #ea580c /* Brand accent color */
+--composio-sidebar: #f7f5f2 /* Light sidebar */
+--composio-sidebar: #252220 /* Dark sidebar */
+--font-sans: 'Inter' /* Body text */
+--font-mono: 'IBM Plex Mono' /* Code blocks */
+```
+
+## Content Structure
+
+```
+content/
+├── docs/ # Main documentation
+├── examples/ # Example guides
+├── changelog/ # Release notes
+└── reference/ # SDK & API reference
+```
+
+## MDX Components
+
+Available globally without imports:
+
+- `Tabs`, `Tab`, `TabsList`, `TabsTrigger`, `TabsContent`
+- `Accordion`, `Accordions`
+- `Callout`
+- `Step`, `Steps`
+- `Card`, `Cards`
+- `ProviderCard`, `ProviderGrid`
+- `FrameworkSelector`, `QuickstartFlow`, `FrameworkOption`
+- `IntegrationTabs`, `IntegrationContent`
+- `ToolTypeFlow`, `ToolTypeOption`
+- `Figure`, `Video`
+- `CapabilityCard`, `CapabilityList`
+- `ToolkitsLanding`
+- `StepTitle`
+- Lucide icons: `ShieldCheck`, `RouteIcon`, `Key`, `Wrench`, `Database`, `Zap`, `Rocket`, `Code`, `Blocks`, `Plug`, `Play`, `Terminal`, `Palette`, `BookOpen`
+
+## Deployment
+
+- **Platform**: Vercel
+- **Project**: `composio/docs`
+- **Root directory**: `docs` (monorepo subfolder)
+- **Build**: `bun install` and `bun run build`
+
+## Common Gotchas
+
+1. **CSS variables**: Use `var(--composio-orange)` not `var(--orange)`. Check `global.css` for defined variables.
+
+2. **Date format**: Changelog dates must be YYYY-MM-DD format (validated in schema and runtime).
+
+3. **Toolkits data**: `public/data/toolkits.json` must exist - errors are thrown, not silently ignored.
+
+4. **Root directory on Vercel**: Set to `docs` with "Include files outside root directory" DISABLED.
+
+5. **Mobile nav**: Always test CSS changes on mobile. Fumadocs uses different nav patterns (dropdown on mobile, horizontal on desktop). Avoid absolute positioning or pseudo-elements that assume horizontal layout.
+
+6. **Twoslash in dev**: Twoslash is disabled in `bun dev` due to heap memory issues. Run `bun run build` locally to catch type errors. See `.claude/context/twoslash.md`.
diff --git a/docs/.claude/context/sdk-reference.md b/docs/.claude/context/sdk-reference.md
new file mode 100644
index 000000000..ed3407c9d
--- /dev/null
+++ b/docs/.claude/context/sdk-reference.md
@@ -0,0 +1,25 @@
+# SDK Reference Documentation
+
+Auto-generated SDK documentation from source code.
+
+## TypeScript SDK
+
+| Item | Path |
+|------|------|
+| Source | `ts/packages/core/src/models/*.ts` (JSDoc comments) |
+| Generator | `ts/packages/core/scripts/generate-docs.ts` |
+| Output | `content/reference/sdk-reference/typescript/` |
+| Regenerate | `pnpm --filter @composio/core generate:docs` |
+
+## Python SDK
+
+| Item | Path |
+|------|------|
+| Source | `python/composio/**/*.py` (docstrings) |
+| Generator | `python/scripts/generate-docs.py` (uses griffe) |
+| Output | `content/reference/sdk-reference/python/` |
+| Regenerate | `cd python && uv run --with griffe python scripts/generate-docs.py` |
+
+## CI Integration
+
+CI auto-generates on changes to `ts/packages/core/src/**` or `python/composio/**` via `.github/workflows/generate-sdk-docs.yml`.
diff --git a/docs/.claude/context/twoslash.md b/docs/.claude/context/twoslash.md
new file mode 100644
index 000000000..ba977ad9e
--- /dev/null
+++ b/docs/.claude/context/twoslash.md
@@ -0,0 +1,103 @@
+# Twoslash - TypeScript Code Block Type Checking
+
+**ALL TypeScript code blocks are type-checked at build time.** This ensures documentation stays in sync with the SDK.
+
+> **Note**: This only validates TypeScript (`ts`, `typescript`, `tsx`) code blocks. Python code blocks are NOT type-checked.
+
+## Key Features
+
+- **Default on**: All TypeScript blocks are validated. No annotation needed.
+- **Build-time validation**: Type errors fail the build.
+- **CI enforcement**: `.github/workflows/docs-typescript-check.yml` runs on PRs to docs/
+- **Disabled in dev**: Twoslash is disabled during `bun dev` to prevent heap memory issues. It only runs during `bun run build` / CI.
+
+## Exclusions
+
+- **Reference docs** (`/content/reference/`): Excluded from Twoslash via collection-level `mdxOptions` in `source.config.ts`. These are auto-generated and don't need type checking.
+
+## Common Patterns
+
+### Basic snippet with setup code (hidden from output)
+
+````md
+```typescript
+import { Composio } from '@composio/core';
+const composio = new Composio({ apiKey: 'key' });
+const userId = 'user_123';
+// ---cut---
+// Only code below this line is shown in docs
+const tools = await composio.tools.get(userId, { toolkits: ['GITHUB'] });
+```
+````
+
+### Using SDK-exported types for callbacks
+
+The SDK exports types for modifiers - use them instead of inline type annotations:
+
+````md
+```typescript
+import { Composio, TransformToolSchemaModifier } from '@composio/core';
+
+const modifySchema: TransformToolSchemaModifier = ({ toolSlug, toolkitSlug, schema }) => {
+ // TypeScript infers all parameter types!
+ return schema;
+};
+```
+````
+
+Available modifier types from `@composio/core`:
+- `beforeExecuteModifier` - for `beforeExecute` callbacks
+- `afterExecuteModifier` - for `afterExecute` callbacks
+- `TransformToolSchemaModifier` - for `modifySchema` callbacks
+
+### Skip type checking (for partial snippets or external deps)
+
+````md
+```typescript
+// @noErrors
+import { SomeExternalThing } from 'not-installed-package';
+```
+````
+
+### Declare external variables in hidden section
+
+When code uses variables that aren't defined in the snippet, declare them before the cut:
+
+````md
+```typescript
+import { Composio } from '@composio/core';
+
+declare const composio: Composio;
+declare const userId: string;
+// ---cut---
+const tools = await composio.tools.get(userId, { toolkits: ['GITHUB'] });
+```
+````
+
+## Annotations
+
+| Annotation | Purpose |
+|------------|---------|
+| `// ---cut---` | Hide code above from output (but include for compilation) |
+| `// @noErrors` | Skip all type checking for this block |
+| `// @errors: 2322` | Expect specific error code (won't fail build) |
+| `// ^?` | Show type on hover at that position |
+
+## Configuration
+
+- **Config**: `source.config.ts` - `transformerTwoslash({ explicitTrigger: false })`
+- **SDK packages**: Installed as devDependencies for import resolution
+- **Reference exclusion**: Uses `applyMdxPreset` with custom `rehypeCodeOptions` (no twoslash transformer)
+
+## Troubleshooting
+
+| Problem | Solution |
+|---------|----------|
+| Import fails | Ensure the package is in `devDependencies` |
+| External dependency | Use `// @noErrors` for examples with packages not in package.json |
+| Setup code needed | Use `// ---cut---` to add imports/declarations that compile but aren't shown |
+| Error code 2304 | "Cannot find name" - declare the variable in hidden section |
+| Error code 2322 | Type mismatch - fix the types or use SDK-exported types |
+| Callback types | Prefer importing SDK types over inline `{ foo: string }` annotations |
+
+Always run `bun run build` locally to validate all code blocks before pushing.
diff --git a/docs/CHANGELOG_GUIDE.md b/docs/.claude/guides/changelog.md
similarity index 100%
rename from docs/CHANGELOG_GUIDE.md
rename to docs/.claude/guides/changelog.md
diff --git a/docs/.gitignore b/docs/.gitignore
index a4ae676f1..1de9e1934 100644
--- a/docs/.gitignore
+++ b/docs/.gitignore
@@ -25,3 +25,6 @@ yarn-error.log*
.vercel
next-env.d.ts
next-env.d.ts.cache
+
+# Claude local settings (permissions are user-specific)
+.claude/settings.local.json
diff --git a/docs/CLAUDE.md b/docs/CLAUDE.md
index d3465fce2..a47dd9c2a 100644
--- a/docs/CLAUDE.md
+++ b/docs/CLAUDE.md
@@ -1,134 +1,59 @@
-# Fumadocs - Composio Documentation
-
-## Project Overview
-This is the Composio documentation site built with Fumadocs (Next.js-based docs framework).
-
-## Key Files
-- `app/global.css` - All custom styles and design tokens
-- `source.config.ts` - MDX collections and schema definitions
-- `lib/source.ts` - Source loaders and utility functions
-- `app/(home)/layout.tsx` - Home layout with navigation
-- `app/docs/layout.tsx` - Docs layout with sidebar
-
-## Design Tokens
-- `--composio-orange: #ea580c` - Brand accent color
-- `--composio-sidebar: #f7f5f2` (light) / `#252220` (dark)
-- `--font-sans: 'Inter'` - Body text
-- `--font-mono: 'IBM Plex Mono'` - Code blocks
-
-## SDK Reference Docs
-Auto-generated SDK documentation from source code.
-
-### TypeScript SDK
-- **Source**: `ts/packages/core/src/models/*.ts` (JSDoc comments)
-- **Generator**: `ts/packages/core/scripts/generate-docs.ts`
-- **Output**: `content/reference/sdk-reference/typescript/`
-- **Regenerate**: `pnpm --filter @composio/core generate:docs`
-
-### Python SDK
-- **Source**: `python/composio/**/*.py` (docstrings)
-- **Generator**: `python/scripts/generate-docs.py` (uses griffe)
-- **Output**: `content/reference/sdk-reference/python/`
-- **Regenerate**: `cd python && uv run --with griffe python scripts/generate-docs.py`
-
-CI auto-generates on changes to `ts/packages/core/src/**` or `python/composio/**` via `.github/workflows/generate-sdk-docs.yml`.
-
-## Common Gotchas
-1. **CSS variables**: Use `var(--composio-orange)` not `var(--orange)`. Check `global.css` for defined variables.
-2. **Date format**: Changelog dates must be YYYY-MM-DD format (validated in schema and runtime)
-3. **Toolkits data**: `public/data/toolkits.json` must exist - errors are thrown, not silently ignored
-4. **Root directory on Vercel**: Set to `docs` with "Include files outside root directory" DISABLED
-5. **Mobile nav**: Always test CSS changes on mobile. Fumadocs uses different nav patterns (dropdown on mobile, horizontal on desktop). Avoid absolute positioning or pseudo-elements that assume horizontal layout.
-6. **Twoslash in dev**: Twoslash is disabled in `bun dev` due to heap memory issues (loads full TypeScript compiler). Type checking only runs during `bun run build`. Run build locally to catch type errors before pushing.
-
-## Twoslash - TypeScript Code Block Type Checking
-
-**ALL TypeScript code blocks are type-checked at build time.** This ensures documentation stays in sync with the SDK.
-
-> **Note**: This only validates TypeScript (`ts`, `typescript`, `tsx`) code blocks. Python code blocks are NOT type-checked.
-
-### Key features
-- **Default on**: All TypeScript blocks are validated. No annotation needed.
-- **Build-time validation**: Type errors fail the build.
-- **CI enforcement**: `.github/workflows/docs-typescript-check.yml` runs on PRs to docs/
-- **Disabled in dev**: Twoslash is disabled during `bun dev` to prevent heap memory issues. It only runs during `bun run build` / CI.
-
-### Exclusions
-- **Reference docs** (`/content/reference/`): Excluded from Twoslash via collection-level `mdxOptions` in `source.config.ts`. These are auto-generated and don't need type checking.
-
-### Common patterns
-
-**Basic snippet with setup code (hidden from output):**
-````md
-```typescript
-import { Composio } from '@composio/core';
-const composio = new Composio({ apiKey: 'key' });
-const userId = 'user_123';
-// ---cut---
-// Only code below this line is shown in docs
-const tools = await composio.tools.get(userId, { toolkits: ['GITHUB'] });
-```
-````
-
-**Using SDK-exported types for callbacks:**
-The SDK exports types for modifiers - use them instead of inline type annotations:
-````md
-```typescript
-import { Composio, TransformToolSchemaModifier } from '@composio/core';
-
-const modifySchema: TransformToolSchemaModifier = ({ toolSlug, toolkitSlug, schema }) => {
- // TypeScript infers all parameter types!
- return schema;
-};
+# Composio Documentation
+
+Documentation site for Composio, built with [Fumadocs](https://fumadocs.dev/).
+
+## Quick Reference
+
+```bash
+bun install # Install dependencies
+bun run dev # Dev server (http://localhost:3000)
+bun run build # Production build (validates TS code blocks)
+bun run types:check # Type check
```
-````
-
-Available modifier types from `@composio/core`:
-- `beforeExecuteModifier` - for `beforeExecute` callbacks
-- `afterExecuteModifier` - for `afterExecute` callbacks
-- `TransformToolSchemaModifier` - for `modifySchema` callbacks
-
-**Skip type checking (for partial snippets or external deps):**
-````md
-```typescript
-// @noErrors
-import { SomeExternalThing } from 'not-installed-package';
+
+## Project Structure
+
```
-````
-
-**Declare external variables in hidden section:**
-When code uses variables that aren't defined in the snippet, declare them before the cut:
-````md
-```typescript
-import { Composio } from '@composio/core';
-
-declare const composio: Composio;
-declare const userId: string;
-// ---cut---
-const tools = await composio.tools.get(userId, { toolkits: ['GITHUB'] });
+docs/
+├── app/ # Next.js app router
+├── content/ # MDX content
+│ ├── docs/ # Main documentation
+│ ├── examples/ # Example guides
+│ ├── changelog/ # Release notes
+│ └── reference/ # SDK & API reference
+├── components/ # React components
+├── lib/ # Utilities
+├── public/ # Static assets
+└── .claude/ # Claude context (see below)
```
-````
-
-### Annotations
-- `// ---cut---` - Hide code above from output (but include for compilation)
-- `// @noErrors` - Skip all type checking for this block
-- `// @errors: 2322` - Expect specific error code (won't fail build)
-- `// ^?` - Show type on hover at that position
-
-### Configuration
-- **Config**: `source.config.ts` - `transformerTwoslash({ explicitTrigger: false })`
-- **SDK packages**: Installed as devDependencies for import resolution
-- **Reference exclusion**: Uses `applyMdxPreset` with custom `rehypeCodeOptions` (no twoslash transformer)
-
-### Troubleshooting
-- If imports fail, ensure the package is in `devDependencies`
-- Use `// @noErrors` for examples with external dependencies not in package.json
-- Use `// ---cut---` to add setup code (imports, variable declarations) that compiles but isn't shown
-- Check CI logs for specific error codes (e.g., 2304 = cannot find name, 2322 = type mismatch)
-- For callback types, prefer importing SDK types over inline `{ foo: string; bar: any }` annotations
-- Run `bun run build` locally to validate all code blocks before pushing
-
-## Deployment
-- Vercel project: `composio/docs`
-- Uses `bun install` and `bun run build`
-- Root directory: `docs` (this is a monorepo subfolder)
+
+## Claude Context
+
+Detailed documentation for Claude is organized in `.claude/`:
+
+### Context (Domain Knowledge)
+- [fumadocs.md](.claude/context/fumadocs.md) - Framework patterns, design tokens, MDX components
+- [twoslash.md](.claude/context/twoslash.md) - TypeScript code block type checking
+- [sdk-reference.md](.claude/context/sdk-reference.md) - SDK doc generation
+
+### Guides (How-To)
+- [changelog.md](.claude/guides/changelog.md) - Writing changelog entries
+
+### Decisions (ADRs)
+- [toolkits.md](.claude/decisions/toolkits.md) - Toolkits page implementation
+- [examples.md](.claude/decisions/examples.md) - Examples page plan
+- [feedback.md](.claude/decisions/feedback.md) - Feedback system
+
+## Key Rules
+
+1. **TypeScript code blocks are type-checked** - All TS code in MDX is validated at build time. See [twoslash.md](.claude/context/twoslash.md).
+
+2. **Run build before pushing** - `bun run build` catches type errors that `bun dev` misses.
+
+3. **CSS variables** - Use `var(--composio-orange)` not `var(--orange)`. Check `app/global.css`.
+
+4. **Date format** - Changelog dates must be YYYY-MM-DD format.
+
+5. **Toolkits data** - `public/data/toolkits.json` must exist; errors are thrown, not ignored.
+
+6. **Test on mobile** - Fumadocs nav differs on mobile. Avoid assumptions about horizontal layout.
diff --git a/docs/app/(home)/docs/[[...slug]]/page.tsx b/docs/app/(home)/docs/[[...slug]]/page.tsx
index 31754a65b..330e22fe9 100644
--- a/docs/app/(home)/docs/[[...slug]]/page.tsx
+++ b/docs/app/(home)/docs/[[...slug]]/page.tsx
@@ -1,4 +1,4 @@
-import { getPageImage, source } from '@/lib/source';
+import { getOgImageUrl, source } from '@/lib/source';
import {
DocsBody,
DocsPage,
@@ -46,11 +46,13 @@ export async function generateMetadata(
const page = source.getPage(params.slug);
if (!page) notFound();
+ const ogImage = getOgImageUrl('docs', page.slugs, page.data.title, page.data.description);
+
return {
title: page.data.title,
description: page.data.description,
- openGraph: {
- images: getPageImage(page).url,
- },
+ alternates: { canonical: page.url },
+ openGraph: { images: [ogImage] },
+ twitter: { card: 'summary_large_image', images: [ogImage] },
};
}
diff --git a/docs/app/(home)/docs/changelog/[...slug]/page.tsx b/docs/app/(home)/docs/changelog/[...slug]/page.tsx
index 911632db4..7a56dabcd 100644
--- a/docs/app/(home)/docs/changelog/[...slug]/page.tsx
+++ b/docs/app/(home)/docs/changelog/[...slug]/page.tsx
@@ -1,4 +1,4 @@
-import { changelogEntries, formatDate, dateToSlug, slugToDate } from '@/lib/source';
+import { changelogEntries, formatDate, dateToSlug, slugToDate, getOgImageUrl } from '@/lib/source';
import { getMDXComponents } from '@/mdx-components';
import {
DocsBody,
@@ -95,8 +95,14 @@ export async function generateMetadata({ params }: PageProps) {
? matchingEntries[0].title
: `Changelog - ${formatDate(dateStr)}`;
+ const description = `Updates from ${formatDate(dateStr)}`;
+ const ogImage = getOgImageUrl('docs', ['changelog', ...slug], title, description);
+
return {
title: `${title} | Composio Changelog`,
- description: `Updates from ${formatDate(dateStr)}`,
+ description,
+ alternates: { canonical: `/docs/changelog/${slug.join('/')}` },
+ openGraph: { images: [ogImage] },
+ twitter: { card: 'summary_large_image', images: [ogImage] },
};
}
diff --git a/docs/app/(home)/examples/[[...slug]]/page.tsx b/docs/app/(home)/examples/[[...slug]]/page.tsx
index fad861716..e53e120c6 100644
--- a/docs/app/(home)/examples/[[...slug]]/page.tsx
+++ b/docs/app/(home)/examples/[[...slug]]/page.tsx
@@ -3,4 +3,4 @@ import { createDocsPage, createGenerateStaticParams, createGenerateMetadata } fr
export default createDocsPage(examplesSource);
export const generateStaticParams = createGenerateStaticParams(examplesSource);
-export const generateMetadata = createGenerateMetadata(examplesSource);
+export const generateMetadata = createGenerateMetadata(examplesSource, 'examples');
diff --git a/docs/app/(home)/reference/[[...slug]]/page.tsx b/docs/app/(home)/reference/[[...slug]]/page.tsx
index f031d503c..3436cfd4a 100644
--- a/docs/app/(home)/reference/[[...slug]]/page.tsx
+++ b/docs/app/(home)/reference/[[...slug]]/page.tsx
@@ -1,5 +1,5 @@
import type { ComponentType } from 'react';
-import { referenceSource } from '@/lib/source';
+import { referenceSource, getOgImageUrl } from '@/lib/source';
import { APIPage } from '@/components/api-page';
import {
DocsBody,
@@ -75,8 +75,13 @@ export async function generateMetadata({
const page = referenceSource.getPage(slug);
if (!page) notFound();
+ const ogImage = getOgImageUrl('reference', page.slugs, page.data.title, page.data.description);
+
return {
title: page.data.title,
description: page.data.description,
+ alternates: { canonical: page.url },
+ openGraph: { images: [ogImage] },
+ twitter: { card: 'summary_large_image', images: [ogImage] },
};
}
diff --git a/docs/app/(home)/toolkits/[[...slug]]/page.tsx b/docs/app/(home)/toolkits/[[...slug]]/page.tsx
index e0de9f6a0..02b3c2ef7 100644
--- a/docs/app/(home)/toolkits/[[...slug]]/page.tsx
+++ b/docs/app/(home)/toolkits/[[...slug]]/page.tsx
@@ -1,4 +1,4 @@
-import { toolkitsSource } from '@/lib/source';
+import { toolkitsSource, getOgImageUrl } from '@/lib/source';
import { notFound } from 'next/navigation';
import { getMDXComponents } from '@/mdx-components';
import { ToolkitDetail } from '@/components/toolkits/toolkit-detail';
@@ -133,18 +133,26 @@ export async function generateMetadata({ params }: { params: Promise<{ slug?: st
// Index page
if (!slug || slug.length === 0) {
+ const ogImage = getOgImageUrl('toolkits', [], 'Toolkits', 'Browse all toolkits supported by Composio');
return {
title: 'Toolkits',
description: 'Browse all toolkits supported by Composio',
+ alternates: { canonical: '/toolkits' },
+ openGraph: { images: [ogImage] },
+ twitter: { card: 'summary_large_image', images: [ogImage] },
};
}
// Check MDX first
const page = toolkitsSource.getPage(slug);
if (page) {
+ const ogImage = getOgImageUrl('toolkits', slug, page.data.title, page.data.description);
return {
title: page.data.title,
description: page.data.description,
+ alternates: { canonical: page.url },
+ openGraph: { images: [ogImage] },
+ twitter: { card: 'summary_large_image', images: [ogImage] },
};
}
@@ -153,9 +161,14 @@ export async function generateMetadata({ params }: { params: Promise<{ slug?: st
const toolkits = await getToolkits();
const toolkit = toolkits.find((t) => t.slug === slug[0]);
if (toolkit) {
+ const title = `${toolkit.name?.trim() || toolkit.slug} - Composio Toolkit`;
+ const ogImage = getOgImageUrl('toolkits', slug, title, toolkit.description);
return {
- title: `${toolkit.name?.trim() || toolkit.slug} - Composio Toolkit`,
+ title,
description: toolkit.description,
+ alternates: { canonical: `/toolkits/${toolkit.slug}` },
+ openGraph: { images: [ogImage] },
+ twitter: { card: 'summary_large_image', images: [ogImage] },
};
}
}
diff --git a/docs/app/og/docs/[...slug]/route.tsx b/docs/app/og/docs/[...slug]/route.tsx
index f4f165b02..13c26e0dd 100644
--- a/docs/app/og/docs/[...slug]/route.tsx
+++ b/docs/app/og/docs/[...slug]/route.tsx
@@ -1,4 +1,4 @@
-import { getPageImage, source } from '@/lib/source';
+import { source } from '@/lib/source';
import { notFound } from 'next/navigation';
import { ImageResponse } from 'next/og';
import { generate as DefaultImage } from 'fumadocs-ui/og';
@@ -7,7 +7,7 @@ export const revalidate = false;
export async function GET(
_req: Request,
- { params }: RouteContext<'/og/docs/[...slug]'>,
+ { params }: { params: Promise<{ slug: string[] }> },
) {
const { slug } = await params;
const page = source.getPage(slug.slice(0, -1));
@@ -28,6 +28,6 @@ export async function GET(
export function generateStaticParams() {
return source.getPages().map((page) => ({
- slug: getPageImage(page).segments,
+ slug: [...page.slugs, 'image.png'],
}));
}
diff --git a/docs/app/og/examples/[...slug]/route.tsx b/docs/app/og/examples/[...slug]/route.tsx
new file mode 100644
index 000000000..2b3426db9
--- /dev/null
+++ b/docs/app/og/examples/[...slug]/route.tsx
@@ -0,0 +1,33 @@
+import { examplesSource } from '@/lib/source';
+import { notFound } from 'next/navigation';
+import { ImageResponse } from 'next/og';
+import { generate as DefaultImage } from 'fumadocs-ui/og';
+
+export const revalidate = false;
+
+export async function GET(
+ _req: Request,
+ { params }: { params: Promise<{ slug: string[] }> },
+) {
+ const { slug } = await params;
+ const page = examplesSource.getPage(slug.slice(0, -1));
+ if (!page) notFound();
+
+ return new ImageResponse(
+ <DefaultImage
+ title={page.data.title}
+ description={page.data.description}
+ site="Composio"
+ />,
+ {
+ width: 1200,
+ height: 630,
+ },
+ );
+}
+
+export function generateStaticParams() {
+ return examplesSource.getPages().map((page) => ({
+ slug: [...page.slugs, 'image.png'],
+ }));
+}
diff --git a/docs/app/og/reference/[...slug]/route.tsx b/docs/app/og/reference/[...slug]/route.tsx
new file mode 100644
index 000000000..3a3aea862
--- /dev/null
+++ b/docs/app/og/reference/[...slug]/route.tsx
@@ -0,0 +1,33 @@
+import { referenceSource } from '@/lib/source';
+import { notFound } from 'next/navigation';
+import { ImageResponse } from 'next/og';
+import { generate as DefaultImage } from 'fumadocs-ui/og';
+
+export const revalidate = false;
+
+export async function GET(
+ _req: Request,
+ { params }: { params: Promise<{ slug: string[] }> },
+) {
+ const { slug } = await params;
+ const page = referenceSource.getPage(slug.slice(0, -1));
+ if (!page) notFound();
+
+ return new ImageResponse(
+ <DefaultImage
+ title={page.data.title}
+ description={page.data.description}
+ site="Composio"
+ />,
+ {
+ width: 1200,
+ height: 630,
+ },
+ );
+}
+
+export function generateStaticParams() {
+ return referenceSource.getPages().map((page) => ({
+ slug: [...page.slugs, 'image.png'],
+ }));
+}
diff --git a/docs/app/og/toolkits/[...slug]/route.tsx b/docs/app/og/toolkits/[...slug]/route.tsx
new file mode 100644
index 000000000..473d2e8e0
--- /dev/null
+++ b/docs/app/og/toolkits/[...slug]/route.tsx
@@ -0,0 +1,97 @@
+import { toolkitsSource } from '@/lib/source';
+import { notFound } from 'next/navigation';
+import { ImageResponse } from 'next/og';
+import { generate as DefaultImage } from 'fumadocs-ui/og';
+import { readFile } from 'fs/promises';
+import { join } from 'path';
+import type { Toolkit } from '@/types/toolkit';
+
+export const revalidate = false;
+
+async function getToolkits(): Promise<Toolkit[]> {
+ const filePath = join(process.cwd(), 'public/data/toolkits.json');
+ try {
+ const data = await readFile(filePath, 'utf-8');
+ return JSON.parse(data) as Toolkit[];
+ } catch {
+ return [];
+ }
+}
+
+export async function GET(
+ _req: Request,
+ { params }: { params: Promise<{ slug: string[] }> },
+) {
+ const { slug } = await params;
+ const pageSlug = slug.slice(0, -1); // Remove 'image.png'
+
+ // Check MDX first
+ const page = toolkitsSource.getPage(pageSlug);
+ if (page) {
+ return new ImageResponse(
+ <DefaultImage
+ title={page.data.title}
+ description={page.data.description}
+ site="Composio"
+ />,
+ {
+ width: 1200,
+ height: 630,
+ },
+ );
+ }
+
+ // Check JSON toolkit
+ if (pageSlug.length === 1) {
+ const toolkits = await getToolkits();
+ const toolkit = toolkits.find((t) => t.slug === pageSlug[0]);
+ if (toolkit) {
+ return new ImageResponse(
+ <DefaultImage
+ title={`${toolkit.name?.trim() || toolkit.slug}`}
+ description={toolkit.description || 'Composio Toolkit'}
+ site="Composio"
+ />,
+ {
+ width: 1200,
+ height: 630,
+ },
+ );
+ }
+ }
+
+ // Index page
+ if (pageSlug.length === 0) {
+ return new ImageResponse(
+ <DefaultImage
+ title="Toolkits"
+ description="Browse all toolkits supported by Composio"
+ site="Composio"
+ />,
+ {
+ width: 1200,
+ height: 630,
+ },
+ );
+ }
+
+ notFound();
+}
+
+export async function generateStaticParams() {
+ // MDX pages
+ const mdxParams = toolkitsSource.getPages().map((page) => ({
+ slug: [...page.slugs, 'image.png'],
+ }));
+
+ // JSON toolkit pages
+ const toolkits = await getToolkits();
+ const jsonParams = toolkits.map((toolkit) => ({
+ slug: [toolkit.slug, 'image.png'],
+ }));
+
+ // Index page
+ const indexParam = { slug: ['image.png'] };
+
+ return [indexParam, ...mdxParams, ...jsonParams];
+}
diff --git a/docs/content/examples/vercel-chat.mdx b/docs/content/examples/vercel-chat.mdx
index f3b1bd51f..ec1ac8423 100644
--- a/docs/content/examples/vercel-chat.mdx
+++ b/docs/content/examples/vercel-chat.mdx
@@ -24,7 +24,7 @@ respective auth configs. Learn how to create auth configs [here](/docs/authentic
Once done, your auth configs will be available in the [Composio dashboard](https://app.composio.dev/integrations).
- <img src="../../../../assets/images/examples/auth-configs.png" alt="Auth configs" />
+ <img src="/assets/images/examples/auth-configs.png" alt="Auth configs" />
### Save auth config IDs to environment variables
@@ -62,7 +62,7 @@ list the toolkits and their connection status, we create a Next.js API route to
fetch the toolkits using Composio SDK.
- <img src="../../../../assets/images/examples/toolkits.png" />
+ <img src="/assets/images/examples/toolkits.png" alt="Toolkits list with connection status" />
### 1. Listing connected accounts
@@ -131,7 +131,7 @@ Users need to connect and disconnect their accounts from the chatbot to enable t
When a user wants to connect their account, we create a connection request that redirects them to the OAuth provider:
- <img src="../../../../assets/images/examples/create-connection.png" />
+ <img src="/assets/images/examples/create-connection.png" alt="Create connection dialog" />
```typescript app/api/connections/initiate/route.ts
@@ -159,7 +159,7 @@ export async function POST(request: Request) {
After initiating a connection, we need to wait for the OAuth flow to complete. We check the connection status to know when it's ready to use:
- <img src="../../../../assets/images/examples/connection-status.png" />
+ <img src="/assets/images/examples/connection-status.png" alt="Connection status indicator" />
```typescript app/api/connections/status/route.ts
@@ -269,7 +269,7 @@ export async function POST(request: Request) {
By default, tool calls appear as raw JSON in the chat interface. To create a better user experience, we can build custom components that display tool calls with proper formatting and loading states.
- <img src="../../../../assets/images/examples/custom-tool-component.png" />
+ <img src="/assets/images/examples/custom-tool-component.png" alt="Custom tool call component" />
You can find the `ToolCall` component at `components/tool-call.tsx`. Here's how to integrate it into your message rendering:
diff --git a/docs/lib/create-docs-page.tsx b/docs/lib/create-docs-page.tsx
index 62229d242..f91f33453 100644
--- a/docs/lib/create-docs-page.tsx
+++ b/docs/lib/create-docs-page.tsx
@@ -8,6 +8,7 @@ import { getMDXComponents } from '@/mdx-components';
import type { Metadata } from 'next';
import { createRelativeLink } from 'fumadocs-ui/mdx';
import { PageActions } from '@/components/page-actions';
+import { getOgImageUrl } from '@/lib/source';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Source = any;
@@ -42,7 +43,7 @@ export function createGenerateStaticParams(source: Source) {
};
}
-export function createGenerateMetadata(source: Source) {
+export function createGenerateMetadata(source: Source, section: string = 'docs') {
return async function generateMetadata({
params,
}: {
@@ -52,9 +53,19 @@ export function createGenerateMetadata(source: Source) {
const page = source.getPage(slug);
if (!page) notFound();
+ const ogImage = getOgImageUrl(section, page.slugs, page.data.title, page.data.description);
+
return {
title: page.data.title,
description: page.data.description,
+ alternates: { canonical: page.url },
+ openGraph: {
+ images: [ogImage],
+ },
+ twitter: {
+ card: 'summary_large_image',
+ images: [ogImage],
+ },
};
};
}
diff --git a/docs/lib/source.ts b/docs/lib/source.ts
index 511323f34..67ccd01bb 100644
--- a/docs/lib/source.ts
+++ b/docs/lib/source.ts
@@ -49,6 +49,17 @@ export function getPageImage(page: InferPageType<typeof source>) {
};
}
+/**
+ * Generate OG image URL for any page section
+ */
+export function getOgImageUrl(section: string, slugs: string[], title?: string, description?: string): string {
+ const params = new URLSearchParams();
+ if (title) params.set('title', title);
+ if (description) params.set('description', description);
+ const query = params.toString() ? `?${params.toString()}` : '';
+ return `/og/${section}/${slugs.join('/')}/image.png${query}`;
+}
+
/**
* Converts MDX content to clean markdown for AI agents.
* Strips JSX components and converts them to plain text equivalents.
diff --git a/docs/public/assets/images/examples/auth-configs.png b/docs/public/assets/images/examples/auth-configs.png
new file mode 100644
index 000000000..695d61d4a
Binary files /dev/null and b/docs/public/assets/images/examples/auth-configs.png differ
diff --git a/docs/public/assets/images/examples/connection-status.png b/docs/public/assets/images/examples/connection-status.png
new file mode 100644
index 000000000..4175b1aea
Binary files /dev/null and b/docs/public/assets/images/examples/connection-status.png differ
diff --git a/docs/public/assets/images/examples/create-connection.png b/docs/public/assets/images/examples/create-connection.png
new file mode 100644
index 000000000..3c9c05c32
Binary files /dev/null and b/docs/public/assets/images/examples/create-connection.png differ
diff --git a/docs/public/assets/images/examples/custom-tool-component.png b/docs/public/assets/images/examples/custom-tool-component.png
new file mode 100644
index 000000000..c5ac21b8e
Binary files /dev/null and b/docs/public/assets/images/examples/custom-tool-component.png differ
diff --git a/docs/public/assets/images/examples/toolkits.png b/docs/public/assets/images/examples/toolkits.png
new file mode 100644
index 000000000..d5e972602
Binary files /dev/null and b/docs/public/assets/images/examples/toolkits.png differ
diff --git a/docs/public/robots.txt b/docs/public/robots.txt
new file mode 100644
index 000000000..f1ace8f4f
--- /dev/null
+++ b/docs/public/robots.txt
@@ -0,0 +1,10 @@
+# Composio Docs - https://docs.composio.dev
+
+User-agent: *
+Allow: /
+
+# Sitemaps
+Sitemap: https://docs.composio.dev/sitemap.xml
+
+# Crawl-delay for politeness (optional, not all bots respect this)
+# Crawl-delay: 1