Skip to Content
Takumi

Fumapress

Generate Open Graph images and page metadata for every docs page with the built-in Fumapress Takumi plugin.

Fumapress is a docs framework on Waku. It ships a Takumi plugin that renders an image for every docs page and adds the matching meta tags. See the Fumapress Takumi docs for the full plugin API.

Default setup

The plugin is part of Fumapress's recommended preset, which is on by default. With no setup, every docs page gets a 1200 × 630 WebP image and these tags:

Generated meta tags
<meta property="og:image" content="/docs/page.webp" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="twitter:card" content="summary_large_image" />

Set site.baseUrl so og:image is an absolute URL. Without it, the tag holds a relative path, which most crawlers cannot follow.

press.config.tsx
import { createPress } from "fumapress";

export default createPress(content).config({
  site: {
    baseUrl: "https://example.com", 
  },
});

Customize the image

Pass ogImage to recommendedPreset() to set options. It takes the options of takumiPlugin(), and ogImage: false turns the images off.

press.config.tsx
import { createPress, recommendedPreset } from "fumapress"; 

export default createPress(content).config({
  preset: recommendedPreset({ ogImage: { width: 1200 } }), 
});

getImage returns the image for one page. It runs with the app context as this, so this.siteConfig and the loaders are available. This example uses the docs card from fumadocs-ui/og/takumi with a Google font:

press.config.tsx
import { generate as generateOgNode } from "fumadocs-ui/og/takumi";
import { recommendedPreset } from "fumapress";
import { googleFonts } from "takumi-js/helpers";

recommendedPreset({
  ogImage: {
    getImage(page) {
      return {
        node: generateOgNode({
          title: page.data.title,
          description: page.data.description,
          site: this.siteConfig.name,
        }),
      };
    },
    options: {
      fonts: googleFonts([{ name: "Noto Serif", weight: [600, 800] }]),
    },
  },
});

getImage returns:

FieldTypeRole
nodeReactNodeThe content Takumi renders
optionsImageResponseOptions, partialForwarded to ImageResponse, no format

Options

These come from TakumiOptions in fumapress/plugins/takumi:

OptionDefaultNotes
getImageA built-in title and description card(page) => { node, options? } 1
optionsNoneImageResponse options shared by every image 2
width1200Image width, also written to og:image:width
height630Image height, also written to og:image:height
path/ (static) or /_takumi (dynamic)Route prefix for image URLs

1 Inside getImage, this is the app context.

2 getImage overrides them per page.

The plugin always encodes WebP, so format is not an option.

Image paths

Image paths follow page slugs. A page at /docs/styles gets /docs/styles.webp under path, and a section index gets index.webp. With i18n, the locale segment comes first.

Fonts

Takumi never reads system fonts. To cover characters outside the built-in Latin font, load families through options.fonts. Put fonts every page uses in the shared options, so they resolve once.

See Fonts, and Styles for the template.

Last updated on