Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 1 | import { OG_RENDER_VERSION } from "@g1t/contracts/og"; |
| 2 | ||
| Social cards for every page: og.g1t.sh | 3 | /** |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 4 | * The version of the cards' design, part of every cache key. Bump it (in |
| 5 | * `packages/contracts/src/og.ts`, which the site and the docs read too) | |
| 6 | * whenever the card design changes, so the cards already cached are drawn | |
| 7 | * again and every page links to a new address. | |
| Social cards for every page: og.g1t.sh | 8 | */ |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 9 | export const RENDER_VERSION = OG_RENDER_VERSION; |
| Social cards for every page: og.g1t.sh | 10 | |
| 11 | /** | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 12 | * The address a card is cached under: the render version, then only the |
| 13 | * parameters that change the card, in order, including the page's own | |
| 14 | * content version `v`, so stray ones (trackers, cache busters) cannot fill | |
| 15 | * the cache. | |
| Social cards for every page: og.g1t.sh | 16 | */ |
| 17 | export function cacheKey(url: URL): string { | |
| 18 | const wanted = | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 19 | url.pathname === "/docs" ? ["title", "section", "description", "v"] : url.pathname === "/image" ? ["path", "v"] : []; |
| Social cards for every page: og.g1t.sh | 20 | const key = new URL(url.pathname, url.origin); |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 21 | key.searchParams.set("render", RENDER_VERSION); |
| Social cards for every page: og.g1t.sh | 22 | for (const name of wanted) { |
| 23 | const value = url.searchParams.get(name); | |
| 24 | if (value !== null) key.searchParams.set(name, value); | |
| 25 | } | |
| 26 | return key.toString(); | |
| 27 | } |