Skip to content
Brok UI

Loading…

No results

OG Image

Open source

Open Graph social-card templates (1200×630) — minimal, editorial, product, profile, stat, quote and more — token-themed and ready to screenshot in an OG route.

Preview

3 of 16

resources/views/blocks/og-image-blog.blade.php Blade
@props([
    'category' => 'Engineering',
    'title' => 'How we ship Open Graph cards that always match the brand',
    'excerpt' => 'A look at the token-driven pipeline behind every social preview we generate.',
    'author' => 'Avery Stone',
    'meta' => '8 min read, Jun 2026',
    'avatar' => null,
    'brand' => 'ogimagecn',
    'logo' => null,
])

{{--
    Open Graph card — "Blog". A light, editorial 1200×630 article card: a category
    badge top-start, a large headline, an excerpt, and an author row (avatar + name
    + meta) at the bottom, with a brand mark in the top-end corner. Adapted from
    ogimagecn.com to our system: the violet accent maps to the `primary` token, the
    light surface uses `bg-card`/`text-card-foreground`, and the card follows the
    active theme. Render it inside a 1200×630 viewport in your OG image route (e.g.
    a Browsershot screenshot) for pixel-accurate social cards.
--}}
@php
    $initials = collect(preg_split('/\s+/', trim((string) $author)))
        ->filter()
        ->map(fn ($part) => mb_substr($part, 0, 1))
        ->take(2)
        ->implode('');
    $initials = mb_strtoupper($initials);
@endphp
<figure
    data-slot="og-image"
    data-variant="blog"
    {{ $attributes->merge(['class' => 'relative isolate flex aspect-[1200/630] w-full flex-col justify-between overflow-hidden rounded-lg border border-border bg-card p-8 text-card-foreground sm:p-12 lg:p-20']) }}
>
    <x-ui.badge variant="default" class="self-start uppercase tracking-wide">{{ __($category) }}</x-ui.badge>

    <figcaption class="flex flex-col">
        <p class="max-w-[1000px] text-balance text-3xl font-bold leading-[1.05] tracking-tight sm:text-5xl lg:text-7xl">{{ __($title) }}</p>
        <p class="mt-4 max-w-[920px] text-pretty text-base leading-snug text-muted-foreground sm:mt-6 sm:text-xl lg:text-3xl">{{ __($excerpt) }}</p>
    </figcaption>

    <div class="flex items-center gap-4 sm:gap-6">
        <x-ui.avatar size="xl" :src="$avatar" :fallback="$initials" :alt="$author" />
        <div class="flex flex-col">
            <span class="text-base font-semibold sm:text-xl lg:text-2xl">{{ __($author) }}</span>
            <span class="text-base text-muted-foreground sm:text-lg lg:text-2xl">{{ __($meta) }}</span>
        </div>
    </div>

    <div class="absolute end-8 top-8 flex items-center gap-4 sm:end-12 sm:top-12 lg:end-20 lg:top-20">
        @if ($logo)
            <img src="{{ $logo }}" alt="" class="size-8 rounded-md object-contain sm:size-10" />
        @else
            <span class="size-8 rounded-md bg-primary sm:size-10" aria-hidden="true"></span>
        @endif
        <span class="text-lg font-bold sm:text-2xl lg:text-3xl">{{ __($brand) }}</span>
    </div>
</figure>

Installation

terminal
php artisan ui:add blocks/og-image-blog

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/og-image-blog writes only the generated targets below. The CLI validates each file hash before writing and prompts before replacing local changes unless --force is used.

Version
1.0.3
License
open
Stability
stable
Contract
v1
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/blocks/og-image-blog.blade.php

Registry dependencies

badge avatar

Package dependencies

composer: jml/brok:^0.2

Use with AI

A brief for your coding agent: what the block is, the install command, how to render it, its props and the rules. Copy it, or open a prompt about this block in an assistant.

og-image-blog.md
# Brok UI block: OG Blog (`og-image-blog`)

A light, editorial Open Graph article card with a category badge, headline, excerpt, an author row with avatar, and a top-end brand mark.

Brok UI is a Laravel Blade registry. `ui:add` copies this block into the app as plain Blade the app owns; it composes installed `<brok:*>` primitives and semantic design tokens.

## Install

```bash
php artisan ui:add blocks/og-image-blog
```

## Render it

```blade
<x-blocks.og-image-blog />
```

## Props

- `category` (string, default `Engineering`) — Category badge shown top-start.
- `title` (string, default `How we ship Open Graph cards that always match the brand`) — Large article headline.
- `excerpt` (string, default `A look at the token-driven pipeline behind every social preview we generate.`) — Supporting excerpt under the headline.
- `author` (string, default `Avery Stone`) — Author name shown in the byline row.
- `meta` (string, default `8 min read, Jun 2026`) — Secondary byline text such as read time and date.
- `avatar` (mixed|null, default `null`) — Optional author avatar image URL; falls back to initials when null.
- `brand` (string, default `ogimagecn`) — Brand wordmark shown next to the logo mark.
- `logo` (mixed|null, default `null`) — Optional logo image URL; falls back to a solid token square when null.

## Use when

- Use for a light, editorial article card with a category badge, headline and excerpt above an author row of avatar, name and read time.
- Suited to blog post and article Open Graph images that need to credit an author and show reading metadata.

## Avoid when

- Avoid when there is no author or byline to show, or a dark testimonial tone is wanted; use og-image-simple (simple) or og-image-quote (quote) instead.

## Rules

- Render the installed block with `<x-blocks.og-image-blog />` and pass data through its props; edit the copied file only for structural changes.
- Keep the semantic design tokens (`bg-background`, `text-muted-foreground`); never swap in raw colour utilities.
- Keep the `data-slot` attributes and the logical (start/end) spacing so the markup still mirrors under `dir="rtl"`.

## Links

- Docs: https://brokui.dev/blocks/og-image-blog
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/og-image-blog.json

Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.

Guidance

Use when

  • Use for a light, editorial article card with a category badge, headline and excerpt above an author row of avatar, name and read time.
  • Suited to blog post and article Open Graph images that need to credit an author and show reading metadata.

Avoid when

  • Avoid when there is no author or byline to show, or a dark testimonial tone is wanted; use og-image-simple (simple) or og-image-quote (quote) instead.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.
Anatomy
figure root category badge headline excerpt author avatar author meta brand mark

Usage

Render the block as a component, passing data where useful:

resources/views/welcome.blade.php Blade
<x-blocks.og-image-blog />

Built from primitives

Composes <brok:*> Semantic tokens Re-themeable RTL-ready

This block composes installed <brok:*> primitives and semantic design tokens only — it does not reimplement any primitive. Re-theme it (light, dark, admin, customer) by editing CSS variables; flip the preview to RTL to confirm it mirrors.

Source

The exact, editable file ui:add writes into your app. The preview above renders this same source — there are no preview-only blocks.

resources/views/blocks/og-image-blog.blade.php Blade
@props([
    'category' => 'Engineering',
    'title' => 'How we ship Open Graph cards that always match the brand',
    'excerpt' => 'A look at the token-driven pipeline behind every social preview we generate.',
    'author' => 'Avery Stone',
    'meta' => '8 min read, Jun 2026',
    'avatar' => null,
    'brand' => 'ogimagecn',
    'logo' => null,
])

{{--
    Open Graph card — "Blog". A light, editorial 1200×630 article card: a category
    badge top-start, a large headline, an excerpt, and an author row (avatar + name
    + meta) at the bottom, with a brand mark in the top-end corner. Adapted from
    ogimagecn.com to our system: the violet accent maps to the `primary` token, the
    light surface uses `bg-card`/`text-card-foreground`, and the card follows the
    active theme. Render it inside a 1200×630 viewport in your OG image route (e.g.
    a Browsershot screenshot) for pixel-accurate social cards.
--}}
@php
    $initials = collect(preg_split('/\s+/', trim((string) $author)))
        ->filter()
        ->map(fn ($part) => mb_substr($part, 0, 1))
        ->take(2)
        ->implode('');
    $initials = mb_strtoupper($initials);
@endphp
<figure
    data-slot="og-image"
    data-variant="blog"
    {{ $attributes->merge(['class' => 'relative isolate flex aspect-[1200/630] w-full flex-col justify-between overflow-hidden rounded-lg border border-border bg-card p-8 text-card-foreground sm:p-12 lg:p-20']) }}
>
    <x-ui.badge variant="default" class="self-start uppercase tracking-wide">{{ __($category) }}</x-ui.badge>

    <figcaption class="flex flex-col">
        <p class="max-w-[1000px] text-balance text-3xl font-bold leading-[1.05] tracking-tight sm:text-5xl lg:text-7xl">{{ __($title) }}</p>
        <p class="mt-4 max-w-[920px] text-pretty text-base leading-snug text-muted-foreground sm:mt-6 sm:text-xl lg:text-3xl">{{ __($excerpt) }}</p>
    </figcaption>

    <div class="flex items-center gap-4 sm:gap-6">
        <x-ui.avatar size="xl" :src="$avatar" :fallback="$initials" :alt="$author" />
        <div class="flex flex-col">
            <span class="text-base font-semibold sm:text-xl lg:text-2xl">{{ __($author) }}</span>
            <span class="text-base text-muted-foreground sm:text-lg lg:text-2xl">{{ __($meta) }}</span>
        </div>
    </div>

    <div class="absolute end-8 top-8 flex items-center gap-4 sm:end-12 sm:top-12 lg:end-20 lg:top-20">
        @if ($logo)
            <img src="{{ $logo }}" alt="" class="size-8 rounded-md object-contain sm:size-10" />
        @else
            <span class="size-8 rounded-md bg-primary sm:size-10" aria-hidden="true"></span>
        @endif
        <span class="text-lg font-bold sm:text-2xl lg:text-3xl">{{ __($brand) }}</span>
    </div>
</figure>

Ownership & lifecycle

Owner, release state, review evidence and adoption for this item.
Owner
Platform UI (@JoshJML)
Current version
1.0.3
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0