# Fumadocs (Framework Mode, Waku): Takumi
URL: /docs/waku/integrations/og/takumi
Source: https://raw.githubusercontent.com/fuma-nama/fumadocs/refs/heads/main/apps/docs/content/docs/(framework)/[framework]/integrations/og/takumi.mdx

Integrate Takumi for framework agnostic and fast metadata image generation.

## Installation [#installation]

```npm
npm install takumi-js
```

## Metadata Image [#metadata-image]

Add a function that returns the image URL of a page, and reference the image in the metadata of docs pages:

```ts tab="src/lib/shared.ts"
import { createGetUrl } from 'fumadocs-core/source';

// [!code ++:7]
const getImageUrl = createGetUrl('/og/docs');

export function getPageImageUrl(page: { slugs: string[]; locale?: string }) {
  const segments = [...page.slugs, 'image.webp'];

  return { segments, url: getImageUrl(segments, page.locale) };
}
```

```tsx tab="src/pages/docs/[...slugs].tsx"
// [!code ++]
import { getPageImageUrl } from '@/lib/shared';

// Somewhere in your page component
return (
  <DocsPage toc={page.data.toc}>
    {/* [!code ++] */}
    <meta property="og:image" content={getPageImageUrl(page).url} />
    {/* ... */}
  </DocsPage>
);
```

> The image of `/docs/my-page` is at `/og/docs/my-page/image.webp`, since WebP images are smaller than PNG ones. To generate PNG, use `image.png` and `format: 'png'` instead.

Then create a route to generate the images:

```tsx title="src/pages/_api/og/docs/[...slugs]/image.webp.tsx"
import { source } from '@/lib/source';
import { generateOGImage } from 'fumadocs-ui/og/takumi';
import { ApiContext } from 'waku/router';

export async function GET(_: Request, { params }: ApiContext<'/og/docs/[...slugs]/image.webp'>) {
  const page = source.getPage(params.slugs);

  if (!page) return new Response(undefined, { status: 404 });

  return generateOGImage({
    title: page.data.title,
    description: page.data.description,
    site: 'My App',
    format: 'webp',
  });
}

export async function getConfig() {
  const pages = source
    .generateParams()
    .map((item) => (item.lang ? [item.lang, ...item.slug] : item.slug));

  return {
    render: 'static' as const,
    staticPaths: pages,
  } as const;
}
```

> Takumi bundles the full-axis (100-900) [`Geist`](https://vercel.com/font) and `Geist Mono` fonts, so no font setup is needed.

See [Takumi's Documentation](https://takumi.kane.tw/docs) for advanced usage.

### Other Templates [#other-templates]

See [Takumi Templates](https://takumi.kane.tw/docs/templates) for the available templates.