- "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>
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
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,
|
||
});
|
||
}
|