astro-og-smart-crop — Brandon Hubbard Engineering
TYPESCRIPT · ASTRO & SOCIAL SEO

astro-og-smart-crop — Saliency-Aware OpenGraph Image Cropper & Card Simulator

astro-og-smart-crop previews how your Astro pages appear across X, LinkedIn, Discord, and iMessage while preventing awkward image crops and title truncation. It computes focal-point crop coordinates for 1200×630 social cards and rewrites overly long og:title tags to fit platform character limits.

$ npm install astro-og-smart-crop
GitHub ↗
01. Architectural Specifications STATUS: PRODUCTION READY
[ 01 // CAPABILITY ]

Social Card Simulator

Renders pixel-accurate simulated cards for X/Twitter, LinkedIn, Facebook, Discord, and Slack unfurls.

[ 02 // CAPABILITY ]

Truncation Prevention

Evaluates character limits and pixel bounding widths to flag awkward ellipsis cutoffs before publishing.

[ 03 // CAPABILITY ]

AI Headline Variants

Prompts Gemini Nano to suggest punchy, SEO-focused titles that strictly fit within platform budgets.

02. Implementation & Usage BUN / ASTRO 5+
// Installation CLI
bun add astro-og-smart-crop
# or
pnpm add astro-og-smart-crop
// Configuration astro.config.mjs
// astro.config.mjs
import { defineConfig } from "astro/config";
import ogSmartCrop from "astro-og-smart-crop";

export default defineConfig({
  integrations: [
    ogSmartCrop({
      platforms: ["twitter", "linkedin", "facebook", "discord", "slack"],
      characterBudgetPadding: 5
    })
  ]
});

// Chrome Built-in AI Prerequisites

  • 1. Open chrome://flags in Google Chrome 128+
  • 2. Set #prompt-api-for-gemini-nano to Enabled
  • 3. Set #optimization-guide-on-device-model to Enabled ByPassPerfRequirement
  • 4. Restart Chrome and verify model status at chrome://components