(params: { title: string; description?: string })
| 1 | export function ogImage(params: { title: string; description?: string }): string { |
| 2 | const title = params.title.trim() |
| 3 | const normalizedTitle = title ? title[0].toUpperCase() + title.slice(1).toLowerCase() : '' |
| 4 | |
| 5 | const search = new URLSearchParams({ title: normalizedTitle }) |
| 6 | |
| 7 | if (params.description) { |
| 8 | const s = params.description.trim() |
| 9 | const i = s.indexOf('.') |
| 10 | const description = (i === -1 ? s : s.slice(0, i + 1)).trim() |
| 11 | if (description) search.set('description', description) |
| 12 | } |
| 13 | |
| 14 | return `/og?${search.toString()}` |
| 15 | } |
no outgoing calls
no test coverage detected