Service: Dynamic OG - EyevinnOSC/community GitHub Wiki

Dynamic OG

Dynamic OG (serviceId oss-apps-dynamic-og) generates Open Graph images on the fly, so each shared URL gets a tailored preview image instead of one static image. In Eyevinn Open Source Cloud (OSC) it is a long-running service instance. Source: oss-apps/dynamic-og.

What it can do

  • Generate a unique og:image per page for blog posts, product pages, event listings or other content-driven sites.
  • Customize each image through query parameters (title, description, theme).
  • Offer templates you can explore and preview interactively in the instance's web UI.
  • Optionally integrate Beam Analytics (usage tracking) and DocsAI (chatbot).

Creating an instance

Call create-service-instance with serviceId: "oss-apps-dynamic-og". No dependencies on other OSC services.

{ "name": "myog" }

Verify with wait-for-service-ready or get-instance-status, then describe-service-instance for the instance URL.

Options

Option Required Type Meaning
name Yes string Name of the instance. Alphanumeric/underscore only (^\w+$), at most 20 characters.
nextBeamAnalyticsId No string Your Beam Analytics ID. When set, usage and performance of the Dynamic OG application are tracked. Corresponds to the NEXT_BEAM_ANALYTICS_ID environment variable.
nextDocsAiId No string Your DocsAI (docsai.app) ID. When set, a DocsAI chatbot is embedded in the UI. Corresponds to the NEXT_DOCS_AI_ID environment variable.

Using the instance

Use the instance as the og:image URL in your HTML, with query parameters per image:

<meta property="og:image"
  content="https://your-instance-url/api/og?title=My+Post+Title&description=A+short+description" />
Parameter Description
title Main headline shown on the image
description Supporting text below the title
theme Visual theme (varies by template)

Full example for the <head> of a page:

<head>
  <meta property="og:title" content="My Article Title" />
  <meta property="og:description" content="A summary of the article." />
  <meta property="og:image"
    content="https://your-instance-url/api/og?title=My+Article+Title&description=A+summary" />
  <meta property="og:image:width" content="1200" />
  <meta property="og:image:height" content="630" />
</head>

For Next.js applications, use generateMetadata:

export async function generateMetadata({ params }) {
  const post = await getPost(params.slug);
  const ogUrl = new URL('https://your-instance-url/api/og');
  ogUrl.searchParams.set('title', post.title);
  ogUrl.searchParams.set('description', post.excerpt);
  return {
    openGraph: {
      images: [{ url: ogUrl.toString(), width: 1200, height: 630 }],
    },
  };
}

OSC CLI equivalent of creating the instance:

osc create oss-apps-dynamic-og my-og-service

Resources

⚠️ **GitHub.com Fallback** ⚠️