DocsPluginsShowcaseReleases
npmStar us on GitHub

Getting Started

IntroductionInstallationProject StructureLayouts and PagesLinking and Navigating

Routing

Folder-Based RoutingFile-Based RoutingDynamic RoutesParallel RoutesIntercepting RoutesCatch-All RoutesMDX & Markdown Pages

Special Files

Loading UIError BoundariesTemplateDefaultNot Found

Data Fetching

LoadersActionsAccessing Route Data

Metadata

Metadata & SEOOpen Graph & TwitterIcons & Favicons

API Routes

API Routes OverviewPlain Function HandlersHono IntegrationDynamic API Routes

Environment Variables

OverviewPrefixes & Client ExposureUsing in API Routes

Styling

CSS OverviewTailwind CSSCSS Modules

Platforms

WebWindowsmacOSLinuxAndroidiOS

Deployment

Deployment OverviewProduction ServerStatic ExportHosting Providers

A native React framework for building cross-platform applications from a single codebase.

Resources

  • Documentation
  • Plugins
  • Showcase
  • Releases

Community

  • GitHub Discussions
  • Reddit
  • Discord
  • LinkedIn

More

  • npm
  • GitHub
  • Issues
  • License

© 2026 Bini Cooperation.

Open Graph & Twitter Cards

Open Graph and Twitter Card tags via document.head - serialized into static HTML at build time.

Overview

Open Graph and Twitter Card tags control how pages look when shared on Facebook, LinkedIn, Slack, and X. Add them to the document export's head node tree on the root layout or on any page. The tags are serialized into the static HTML at build time and appear in both development and production.

  • Open Graph: title, description, url, type, images, site name, locale
  • Twitter Cards: card type, title, description, creator, images
  • Default image: place public/og-image.png (1200×630 recommended) and reference it from document.head
  • Both environments: tags declared in document.head render in dev and are also injected into pre-rendered HTML by bini-ssg at build time

Open Graph Overview

Open Graph tags control previews on Facebook, LinkedIn, and Slack.

src/app/about/page.tsx
export const document = {
  head: (
    <>
      <title>About Us</title>
      <meta name="description" content="Learn more about our company and team" />

      <meta property="og:title" content="About Us - My Bini.js App" />
      <meta property="og:description" content="Learn more about our company and team" />
      <meta property="og:url" content="https://myapp.com/about" />
      <meta property="og:type" content="website" />
      <meta property="og:site_name" content="My Bini.js App" />
      <meta property="og:locale" content="en_US" />
      <meta property="og:image" content="/og-image.png" />
      <meta property="og:image:width" content="1200" />
      <meta property="og:image:height" content="630" />
      <meta property="og:image:alt" content="About Us" />
    </>
  ),
}
document.head is a full JSX node tree. It is serialized into the static HTML. Attribute values and children must be static — dynamic values are dropped with a BINI_R004 warning.
Put a default image at public/og-image.png and reference it from document.head. Replace it with your own 1200×630 asset.

Open Graph Fields

TagExamplePurpose
og:title<meta property="og:title" content="..." />Card title
og:description<meta property="og:description" content="..." />Card description
og:url<meta property="og:url" content="https://..." />Canonical URL
og:type<meta property="og:type" content="website" />Content type
og:image<meta property="og:image" content="/og-image.png" />Preview image URL
og:image:width<meta property="og:image:width" content="1200" />1200 recommended
og:image:height<meta property="og:image:height" content="630" />630 recommended
og:image:alt<meta property="og:image:alt" content="..." />Alt text
og:site_name<meta property="og:site_name" content="My App" />Site name
og:locale<meta property="og:locale" content="en_US" />Locale

Image attributes

AttributeRecommendedNotes
og:image—Image URL
og:image:width1200Pixel width
og:image:height630Pixel height
og:image:alt—Alt text

Twitter Cards Overview

Twitter (X) cards control how links appear in the feed. The most common types are summary and summary_large_image. Add the meta tags to document.head in the page or root layout.

src/app/blog/[slug]/page.tsx
export const document = {
  head: (
    <>
      <title>Blog Post</title>
      <meta name="description" content="A comprehensive guide to Bini.js" />

      <meta name="twitter:card" content="summary_large_image" />
      <meta name="twitter:title" content="Blog Post - My Bini.js App" />
      <meta name="twitter:description" content="A comprehensive guide to Bini.js" />
      <meta name="twitter:creator" content="@bini_js" />
      <meta name="twitter:image" content="/og-image.png" />
    </>
  ),
}

Twitter Card Fields

TagExamplePurpose
twitter:card<meta name="twitter:card" content="summary_large_image" />Card type
twitter:title<meta name="twitter:title" content="..." />Card title
twitter:description<meta name="twitter:description" content="..." />Card description
twitter:creator<meta name="twitter:creator" content="@handle" />Author handle
twitter:image<meta name="twitter:image" content="/og-image.png" />Preview image

Card types

  • summary - small image
  • summary_large_image - large image (recommended)
  • app - mobile app card
  • player - video / audio

How It Works

The document export is statically extracted by bini-router and stripped from the client bundle. In development, the dev server inlines the head node tree into the rendered page. During vite build, bini-ssg serializes the head tags into each pre-rendered HTML file.

TagApplied in devApplied at build
document.head (title, meta, link, script)YesYes
document.html / document.body attributesYesYes
  • Nearest wins: the nearest document export (page first, then the closest layout) is used. Documents are not merged.
  • Static only: attribute values and children must be static. Dynamic values are dropped with a BINI_R004 warning.
  • JSON-LD: dangerouslySetInnerHTML={{ __html: <static value> }} is supported for JSON-LD scripts.
  • Dynamic routes: head tags declared in a page's document are applied per route pattern (for example /blog/:slug), not per concrete URL. To vary tags per URL, render <title> / <meta> from the page component (the dev server hoists them into <head> when no document.head exists).

Complete Example

Combined Open Graph and Twitter metadata for a blog post.

src/app/blog/[slug]/page.tsx
export const document = {
  head: (
    <>
      <title>Getting Started with Bini.js</title>
      <meta
        name="description"
        content="Learn how to build native cross-platform apps with Bini.js"
      />

      {/* Open Graph */}
      <meta property="og:title" content="Getting Started with Bini.js" />
      <meta
        property="og:description"
        content="Learn how to build native cross-platform apps with Bini.js"
      />
      <meta property="og:url" content="https://myapp.com/blog/getting-started" />
      <meta property="og:type" content="article" />
      <meta property="og:site_name" content="My Bini.js App" />
      <meta property="og:locale" content="en_US" />
      <meta property="og:image" content="https://myapp.com/images/blog/og.png" />
      <meta property="og:image:width" content="1200" />
      <meta property="og:image:height" content="630" />
      <meta property="og:image:alt" content="Getting Started with Bini.js" />

      {/* Twitter */}
      <meta name="twitter:card" content="summary_large_image" />
      <meta name="twitter:title" content="Getting Started with Bini.js" />
      <meta
        name="twitter:description"
        content="Learn how to build native cross-platform apps with Bini.js"
      />
      <meta name="twitter:creator" content="@bini_js" />
      <meta name="twitter:image" content="https://myapp.com/images/blog/og.png" />
    </>
  ),
}
Use images at least 1200×630 for consistent previews across platforms. For dynamic routes such as /blog/:slug, the injected tags use the route pattern. To vary tags per URL, render <title> / <meta> from the page component instead.

Metadata

Export document.head for site-wide head tags and page-level SEO.

Icons & Favicons

Set icons and web manifests.

Layouts and Pages

Create your first pages and wrap them in shared layouts.

Dynamic Routes

Match URL segments with dynamic parameters and catch-alls.

Deployment

Deploy to Node, Vercel, Netlify, Cloudflare, or Deno, or build native apps in CI.

Installation

Review CLI flags and system requirements.

Was this helpful?
PreviousMetadata
NextIcons & Favicons

On this page

  • Overview
  • Open Graph Overview
  • Open Graph Fields
  • Twitter Cards Overview
  • Twitter Card Fields
  • How It Works
  • Complete Example
Edit this page on GitHub

Open Graph & Twitter Cards

Open Graph and Twitter Card tags via document.head - serialized into static HTML at build time.

Overview

Open Graph and Twitter Card tags control how pages look when shared on Facebook, LinkedIn, Slack, and X. Add them to the document export's head node tree on the root layout or on any page. The tags are serialized into the static HTML at build time and appear in both development and production.

  • Open Graph: title, description, url, type, images, site name, locale
  • Twitter Cards: card type, title, description, creator, images
  • Default image: place public/og-image.png (1200×630 recommended) and reference it from document.head
  • Both environments: tags declared in document.head render in dev and are also injected into pre-rendered HTML by bini-ssg at build time

Open Graph Overview

Open Graph tags control previews on Facebook, LinkedIn, and Slack.

src/app/about/page.tsx
export const document = {
  head: (
    <>
      <title>About Us</title>
      <meta name="description" content="Learn more about our company and team" />

      <meta property="og:title" content="About Us - My Bini.js App" />
      <meta property="og:description" content="Learn more about our company and team" />
      <meta property="og:url" content="https://myapp.com/about" />
      <meta property="og:type" content="website" />
      <meta property="og:site_name" content="My Bini.js App" />
      <meta property="og:locale" content="en_US" />
      <meta property="og:image" content="/og-image.png" />
      <meta property="og:image:width" content="1200" />
      <meta property="og:image:height" content="630" />
      <meta property="og:image:alt" content="About Us" />
    </>
  ),
}
document.head is a full JSX node tree. It is serialized into the static HTML. Attribute values and children must be static — dynamic values are dropped with a BINI_R004 warning.
Put a default image at public/og-image.png and reference it from document.head. Replace it with your own 1200×630 asset.

Open Graph Fields

TagExamplePurpose
og:title<meta property="og:title" content="..." />Card title
og:description<meta property="og:description" content="..." />Card description
og:url<meta property="og:url" content="https://..." />Canonical URL
og:type<meta property="og:type" content="website" />Content type
og:image<meta property="og:image" content="/og-image.png" />Preview image URL
og:image:width<meta property="og:image:width" content="1200" />1200 recommended
og:image:height<meta property="og:image:height" content="630" />630 recommended
og:image:alt<meta property="og:image:alt" content="..." />Alt text
og:site_name<meta property="og:site_name" content="My App" />Site name
og:locale<meta property="og:locale" content="en_US" />Locale

Image attributes

AttributeRecommendedNotes
og:image—Image URL
og:image:width1200Pixel width
og:image:height630Pixel height
og:image:alt—Alt text

Twitter Cards Overview

Twitter (X) cards control how links appear in the feed. The most common types are summary and summary_large_image. Add the meta tags to document.head in the page or root layout.

src/app/blog/[slug]/page.tsx
export const document = {
  head: (
    <>
      <title>Blog Post</title>
      <meta name="description" content="A comprehensive guide to Bini.js" />

      <meta name="twitter:card" content="summary_large_image" />
      <meta name="twitter:title" content="Blog Post - My Bini.js App" />
      <meta name="twitter:description" content="A comprehensive guide to Bini.js" />
      <meta name="twitter:creator" content="@bini_js" />
      <meta name="twitter:image" content="/og-image.png" />
    </>
  ),
}

Twitter Card Fields

TagExamplePurpose
twitter:card<meta name="twitter:card" content="summary_large_image" />Card type
twitter:title<meta name="twitter:title" content="..." />Card title
twitter:description<meta name="twitter:description" content="..." />Card description
twitter:creator<meta name="twitter:creator" content="@handle" />Author handle
twitter:image<meta name="twitter:image" content="/og-image.png" />Preview image

Card types

  • summary - small image
  • summary_large_image - large image (recommended)
  • app - mobile app card
  • player - video / audio

How It Works

The document export is statically extracted by bini-router and stripped from the client bundle. In development, the dev server inlines the head node tree into the rendered page. During vite build, bini-ssg serializes the head tags into each pre-rendered HTML file.

TagApplied in devApplied at build
document.head (title, meta, link, script)YesYes
document.html / document.body attributesYesYes
  • Nearest wins: the nearest document export (page first, then the closest layout) is used. Documents are not merged.
  • Static only: attribute values and children must be static. Dynamic values are dropped with a BINI_R004 warning.
  • JSON-LD: dangerouslySetInnerHTML={{ __html: <static value> }} is supported for JSON-LD scripts.
  • Dynamic routes: head tags declared in a page's document are applied per route pattern (for example /blog/:slug), not per concrete URL. To vary tags per URL, render <title> / <meta> from the page component (the dev server hoists them into <head> when no document.head exists).

Complete Example

Combined Open Graph and Twitter metadata for a blog post.

src/app/blog/[slug]/page.tsx
export const document = {
  head: (
    <>
      <title>Getting Started with Bini.js</title>
      <meta
        name="description"
        content="Learn how to build native cross-platform apps with Bini.js"
      />

      {/* Open Graph */}
      <meta property="og:title" content="Getting Started with Bini.js" />
      <meta
        property="og:description"
        content="Learn how to build native cross-platform apps with Bini.js"
      />
      <meta property="og:url" content="https://myapp.com/blog/getting-started" />
      <meta property="og:type" content="article" />
      <meta property="og:site_name" content="My Bini.js App" />
      <meta property="og:locale" content="en_US" />
      <meta property="og:image" content="https://myapp.com/images/blog/og.png" />
      <meta property="og:image:width" content="1200" />
      <meta property="og:image:height" content="630" />
      <meta property="og:image:alt" content="Getting Started with Bini.js" />

      {/* Twitter */}
      <meta name="twitter:card" content="summary_large_image" />
      <meta name="twitter:title" content="Getting Started with Bini.js" />
      <meta
        name="twitter:description"
        content="Learn how to build native cross-platform apps with Bini.js"
      />
      <meta name="twitter:creator" content="@bini_js" />
      <meta name="twitter:image" content="https://myapp.com/images/blog/og.png" />
    </>
  ),
}
Use images at least 1200×630 for consistent previews across platforms. For dynamic routes such as /blog/:slug, the injected tags use the route pattern. To vary tags per URL, render <title> / <meta> from the page component instead.

Metadata

Export document.head for site-wide head tags and page-level SEO.

Icons & Favicons

Set icons and web manifests.

Layouts and Pages

Create your first pages and wrap them in shared layouts.

Dynamic Routes

Match URL segments with dynamic parameters and catch-alls.

Deployment

Deploy to Node, Vercel, Netlify, Cloudflare, or Deno, or build native apps in CI.

Installation

Review CLI flags and system requirements.

Was this helpful?
PreviousMetadata
NextIcons & Favicons

On this page

  • Overview
  • Open Graph Overview
  • Open Graph Fields
  • Twitter Cards Overview
  • Twitter Card Fields
  • How It Works
  • Complete Example
Edit this page on GitHub