21 lines901 bytesCodeBlame
1/**
2 * Social cards (services/og, at og.g1t.sh), as the site and the docs link
3 * to them.
4 *
5 * Bump `OG_RENDER_VERSION` whenever the cards' design changes: the logo,
6 * the layout, the type, the colours or the brand line. It is part of every
7 * card's address and of og's cache key, so a new design gets new addresses
8 * everywhere at once: og's edge cache, browsers and the caches of every
9 * site that has already fetched a card. Without a bump, a redeployed og
10 * keeps serving the cards it drew before.
11 */
12export const OG_RENDER_VERSION = "2";
13
14/**
15 * A card's `v` parameter: the render version, then, when the page has one,
16 * the version of what the card shows (a fingerprint of its title, counts
17 * and so on), so a card is drawn again when either changes.
18 */
19export function ogVersion(content?: string): string {
20 return content ? `${OG_RENDER_VERSION}.${content}` : OG_RENDER_VERSION;
21}