Files
kolaytercih/src/app/universite/[slug]/opengraph-image.tsx
bilalgursen 3fa5cab906 feat(veri): katalog/OG/rapor metinleri yılı veri-yillari.ts'ten okur — 2026 yüklemesi P-C
- "2025 yerleştirme" → SON_YIL, "2026 tercihleri" → TERCIH_YILI, başlık yılı → BASLIK_YILI
- yazdırılabilir rapor dipnotu: "2021–2025" → VERI_ARALIGI
- meraklısına 1. bölüm: efektif sıra açıklaması yılsız
- KATALOG_VERI_TARIHI: 2026-09-21 (2026 verisinin çekim tarihi)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 16:53:42 +03:00

53 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { readFile } from "node:fs/promises";
import path from "node:path";
import { getAllUniversiteler } from "@/lib/katalog";
import { trBaslikDuzeni } from "@/lib/slug";
import { uniLogoYolu } from "@/lib/uni-logolar";
import {
createOgSayfaImage,
OG_CONTENT_TYPE,
OG_SIZE,
} from "@/lib/og-sayfa";
import { SON_YIL } from "@/lib/veri-yillari";
export const alt = "Üniversite taban puanları ve sıralamaları — KolayTercih";
export const size = OG_SIZE;
export const contentType = OG_CONTENT_TYPE;
export default async function Image({
params,
}: {
params: Promise<{ slug: string }>;
}) {
const { slug } = await params;
const uni = getAllUniversiteler().find((u) => u.slug === slug);
const ad = uni?.ad ?? "Üniversite";
const parcalar: string[] = [];
if (uni?.il) parcalar.push(trBaslikDuzeni(uni.il));
if (uni?.programSayisi != null) {
parcalar.push(`${uni.programSayisi.toLocaleString("tr-TR")} program`);
}
parcalar.push(`${SON_YIL} yerleştirme verileri`);
// Logo dosyası varsa OG kartına data URI olarak gömülür; okuma hatası
// kartı düşürmesin diye sessizce logosuz karta düşülür.
let logo: string | undefined;
if (uniLogoYolu(slug)) {
try {
const buf = await readFile(
path.join(process.cwd(), "public", "uni-logo", `${slug}.png`),
);
logo = `data:image/png;base64,${buf.toString("base64")}`;
} catch {
logo = undefined;
}
}
return createOgSayfaImage({
eyebrow: "Üniversite",
title: `${ad} taban puanları`,
description: parcalar.join(" · "),
logo,
});
}