Files
zeekay 76b47a4b81 The plan cards list the catalog's lines as served
The cards no longer rewrite a plan's lines in the browser: Free's Hanzo
Dev, MCP and CLI lines were dropped and appended to Pro's, and every Max
was given "Hanzo Bot included". @hanzo/plans 1.8.22 says it itself, in
its own order, with each grant a line claims held to the entitlement
behind it, so what a card lists is what GET /v1/billing/plans serves.

The pricing share card draws the same: Free's third line is web search,
Pro's first is Hanzo Dev. Redrawn, so every card takes v=4.
2026-10-20 08:16:34 -07:00

60 lines
2.0 KiB
TypeScript

/**
* The social preview cards: one per page that has its own, drawn by
* scripts/generate-og.mjs into public/og/, and the default card at
* public/og-image.png for every other page. Each is 2400x1260 (a 1.9:1 card at
* 2x), measured from the files.
*
* A share preview is cached by its address, so a redraw raises VERSION and
* every card takes a new one.
*/
const VERSION = 4
/** A card's address: its file in `public/`, at the cards' version. */
const card = (file: string) => `${file}?v=${VERSION}`
export const OG_IMAGE = {
url: card('/og-image.png'),
width: 2400,
height: 1260,
} as const
/** The pages with a card of their own. */
export const OG_IMAGES_BY_PATH: Record<string, string> = {
'/': card('/og/home.png'),
'/login': card('/og/login.png'),
'/signup': card('/og/signup.png'),
'/pricing': card('/og/pricing.png'),
'/models': card('/og/models.png'),
'/api': card('/og/api.png'),
'/enterprise': card('/og/enterprise.png'),
'/contact-sales': card('/og/enterprise.png'),
'/careers': card('/og/careers.png'),
'/research': card('/og/research.png'),
'/security': card('/og/security.png'),
'/products': card('/og/products.png'),
'/about': card('/og/about.png'),
}
/** Resolves the OG card URL for a given path, defaulting to `/og-image.png`. */
export function getOgImageUrl(path?: string): string {
if (!path) return OG_IMAGE.url
const clean = path.replace(/\/+$/, '') || '/'
return OG_IMAGES_BY_PATH[clean] ?? OG_IMAGE.url
}
/** `openGraph.images` for a page — accepts an optional card URL override. */
export const ogImages = (alt: string, imageUrl?: string) => [
{
url: imageUrl ?? OG_IMAGE.url,
width: OG_IMAGE.width,
height: OG_IMAGE.height,
alt,
},
]
/** `twitter.images` — Twitter takes bare URLs. Defaults to the canonical card. */
export const twitterImages = [OG_IMAGE.url]
/** Helper to generate twitter.images with an explicit or path-resolved URL. */
export const getTwitterImages = (imageUrl?: string) => [imageUrl ?? OG_IMAGE.url]