From d9e125c5debfa1e89eba35b6e8bf1e6b4e199272 Mon Sep 17 00:00:00 2001
From: bilalgursen
Date: Mon, 21 Sep 2026 04:47:29 +0300
Subject: [PATCH] =?UTF-8?q?feat(rehber):=20guncelleme=20alan=C4=B1=20?=
=?UTF-8?q?=E2=86=92=20sitemap/JSON-LD/OG/g=C3=B6r=C3=BCn=C3=BCr=20tarih?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Frontmatter'a isteğe bağlı `guncelleme` alanı geldi ve uçtan uca akıyor:
sitemap lastmod (yazı + /rehber dizini), Article JSON-LD dateModified,
og:article modified_time ve makale başlığının altındaki görünür tarih
satırı. `tarih`/`guncelleme` YYYY-AA-GG değilse ya da güncelleme yayından
önceyse build kırılır. Tarih metni saat diliminden bağımsız `trTarih` ile
üretilir.
Co-Authored-By: Claude Fable 5.1
---
src/app/sitemap.ts | 28 ++++++++++++---
.../rehber/components/rehber-makale.tsx | 17 ++++++++-
src/lib/rehber.ts | 36 +++++++++++++++++--
src/lib/seo.tsx | 3 ++
src/lib/tarih.ts | 30 ++++++++++++++++
5 files changed, 106 insertions(+), 8 deletions(-)
create mode 100644 src/lib/tarih.ts
diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts
index c47be30..7864436 100644
--- a/src/app/sitemap.ts
+++ b/src/app/sitemap.ts
@@ -19,7 +19,6 @@ const staticEntries: MetadataRoute.Sitemap = [
priority: 0.8,
changeFrequency: "weekly",
},
- { url: `${SITE_URL}/rehber`, priority: 0.8, changeFrequency: "weekly" },
{ url: `${SITE_URL}/paket`, priority: 0.7, changeFrequency: "monthly" },
{ url: `${SITE_URL}/meraklisina`, priority: 0.6, changeFrequency: "monthly" },
{ url: `${SITE_URL}/iletisim`, priority: 0.3, changeFrequency: "yearly" },
@@ -42,11 +41,32 @@ export default async function sitemap(): Promise {
changeFrequency: "monthly",
}),
);
- const rehberler: MetadataRoute.Sitemap = getAllRehberler().map((y) => ({
+ const yazilar = getAllRehberler();
+ const rehberler: MetadataRoute.Sitemap = yazilar.map((y) => ({
url: `${SITE_URL}/rehber/${y.slug}`,
- lastModified: y.tarih,
+ lastModified: y.guncelleme ?? y.tarih,
priority: 0.7,
changeFrequency: "monthly",
}));
- return [...staticEntries, ...bolumler, ...universiteler, ...rehberler];
+ // /rehber dizini en son dokunulan yazı kadar tazedir (ISO tarihler metin
+ // olarak karşılaştırılabilir). Hiç yazı yoksa lastmod hiç yazılmaz.
+ const rehberSonDegisiklik = yazilar
+ .map((y) => y.guncelleme ?? y.tarih)
+ .reduce(
+ (enBuyuk, t) => (enBuyuk === undefined || t > enBuyuk ? t : enBuyuk),
+ undefined,
+ );
+ const rehberDizini: MetadataRoute.Sitemap[number] = {
+ url: `${SITE_URL}/rehber`,
+ lastModified: rehberSonDegisiklik,
+ priority: 0.8,
+ changeFrequency: "weekly",
+ };
+ return [
+ ...staticEntries,
+ rehberDizini,
+ ...bolumler,
+ ...universiteler,
+ ...rehberler,
+ ];
}
diff --git a/src/features/rehber/components/rehber-makale.tsx b/src/features/rehber/components/rehber-makale.tsx
index bd7612a..4443ced 100644
--- a/src/features/rehber/components/rehber-makale.tsx
+++ b/src/features/rehber/components/rehber-makale.tsx
@@ -8,6 +8,7 @@ import {
breadcrumbJsonLd,
sayfaMetadata,
} from "@/lib/seo";
+import { trTarih } from "@/lib/tarih";
import { CtaSiraForm } from "@/features/sihirbaz/components/cta-sira-form";
import { ElCizimiSema } from "./el-cizimi-sema";
import { RehberKapak } from "./rehber-kapak";
@@ -29,7 +30,11 @@ export function rehberYaziMetadata(slug: string): Metadata {
title: yazi.baslik,
description: yazi.aciklama,
path: `/rehber/${slug}`,
- openGraph: { type: "article", publishedTime: yazi.tarih },
+ openGraph: {
+ type: "article",
+ publishedTime: yazi.tarih,
+ modifiedTime: yazi.guncelleme ?? yazi.tarih,
+ },
});
}
@@ -49,6 +54,7 @@ export function RehberMakale({ slug }: { slug: string }) {
description: yazi.aciklama,
path: `/rehber/${slug}`,
datePublished: yazi.tarih,
+ dateModified: yazi.guncelleme,
})}
/>
{yazi.aciklama}
+
+ Yayın:
+ {yazi.guncelleme ? (
+ <>
+ {" · "}Güncelleme:{" "}
+
+ >
+ ) : null}
+