import { readFile } from 'node:fs/promises'; import path from 'node:path'; import { ImageResponse } from 'next/og'; export const OG_SIZE = { width: 1200, height: 630 }; /** * Шрифты лежат в apps/landing/assets: Rubik — латиница и кириллица, * Noto Sans Armenian — армянский (без него вместо букв были квадраты). Китайский Next догружает сам. */ async function fonts() { const dir = path.join(process.cwd(), 'assets'); const [rubik, armenian] = await Promise.all([readFile(path.join(dir, 'Rubik-ExtraBold.ttf')), readFile(path.join(dir, 'NotoSansArmenian-Bold.ttf'))]); return [ { name: 'Rubik', data: rubik, weight: 800 as const, style: 'normal' as const }, { name: 'Noto Sans Armenian', data: armenian, weight: 700 as const, style: 'normal' as const }, ]; } /** OG-картинка в цветах тёмной главной: заголовок страницы, домен и полоски четырёх направлений */ export async function ogImage(title: string) { return new ImageResponse( (
Barev Club
40 ? 64 : 80, lineHeight: 1.05, letterSpacing: -2, maxWidth: 1000 }}>{title}
{['#A8C38A', '#F9CDB0', '#CFC8F5', '#F7DA6E'].map((c) => (
))}
barevclub.com
), { ...OG_SIZE, fonts: await fonts() }, ); }