feat(ssg): add ISR (revalidate=60) for dynamic database pages to keep data fresh

This commit is contained in:
mstfyldz
2026-05-30 23:25:14 +03:00
parent 2c24229caa
commit f777e1f104
6 changed files with 16 additions and 6 deletions
+2
View File
@@ -4,6 +4,8 @@ import { getBlogPosts } from "@/app/actions";
import BlogDetailClient from "@/components/BlogDetailClient"; import BlogDetailClient from "@/components/BlogDetailClient";
import { notFound } from "next/navigation"; import { notFound } from "next/navigation";
export const revalidate = 60;
// Convert DB format to expected BlogPost format // Convert DB format to expected BlogPost format
function mapBlogPost(dbPost: any) { function mapBlogPost(dbPost: any) {
return { return {
+2
View File
@@ -3,6 +3,8 @@ import type { Locale } from "@/i18n-config";
import BlogClient from "@/components/BlogClient"; import BlogClient from "@/components/BlogClient";
import { getBlogPosts } from "@/app/actions"; import { getBlogPosts } from "@/app/actions";
export const revalidate = 60;
export async function generateMetadata({ params }: { params: Promise<{ lang: Locale }> }) { export async function generateMetadata({ params }: { params: Promise<{ lang: Locale }> }) {
const { lang } = await params; const { lang } = await params;
const dict = await getDictionary(lang); const dict = await getDictionary(lang);
+2
View File
@@ -5,6 +5,8 @@ import { getProjects } from "@/app/actions";
import { slugify } from "@/lib/utils"; import { slugify } from "@/lib/utils";
import { notFound } from "next/navigation"; import { notFound } from "next/navigation";
export const revalidate = 60;
export async function generateMetadata({ params }: { params: Promise<{ lang: Locale, slug: string }> }) { export async function generateMetadata({ params }: { params: Promise<{ lang: Locale, slug: string }> }) {
const { lang, slug } = await params; const { lang, slug } = await params;
const dict = await getDictionary(lang); const dict = await getDictionary(lang);
+2
View File
@@ -4,6 +4,8 @@ import WorkDetailClient from "@/components/WorkDetailClient";
import { notFound } from "next/navigation"; import { notFound } from "next/navigation";
import { getProjects } from "@/app/actions"; import { getProjects } from "@/app/actions";
export const revalidate = 60;
// ── Static params for all slug × lang combinations ── // ── Static params for all slug × lang combinations ──
export async function generateStaticParams() { export async function generateStaticParams() {
const langs: Locale[] = ["en", "tr"]; const langs: Locale[] = ["en", "tr"];
+2
View File
@@ -3,6 +3,8 @@ import type { Locale } from "@/i18n-config";
import WorkClient from "@/components/WorkClient"; import WorkClient from "@/components/WorkClient";
import { getProjects } from "@/app/actions"; import { getProjects } from "@/app/actions";
export const revalidate = 60;
export async function generateMetadata({ params }: { params: Promise<{ lang: Locale }> }) { export async function generateMetadata({ params }: { params: Promise<{ lang: Locale }> }) {
const { lang } = await params; const { lang } = await params;
const dict = await getDictionary(lang); const dict = await getDictionary(lang);
+6 -6
View File
@@ -13,11 +13,11 @@ export default function Footer({ lang, dict }: { lang: Locale; dict: any }) {
const registry = [ const registry = [
{ name: dict.nav.services, href: `/${lang}/services` }, { name: dict.nav.services, href: `/${lang}/services` },
{ name: dict.nav.work, href: `/${lang}/work` }, { name: dict.nav.work, href: `/${lang}/work` },
{ name: dict.nav.process, href: `/${lang}/process` }, { name: dict.nav.process, href: `/${lang}/process` },
{ name: dict.nav.blog, href: `/${lang}/blog` }, { name: dict.nav.blog, href: `/${lang}/blog` },
{ name: dict.nav.partners, href: `/${lang}/partners` }, { name: dict.nav.partners, href: `/${lang}/partners` },
{ name: dict.nav.faq, href: `/${lang}/faq` }, { name: dict.nav.faq, href: `/${lang}/faq` },
]; ];
return ( return (
@@ -26,8 +26,8 @@ export default function Footer({ lang, dict }: { lang: Locale; dict: any }) {
{/* Big CTA */} {/* Big CTA */}
<div className="border-b border-[#C8C2B8] px-6 py-20"> <div className="border-b border-[#C8C2B8] px-6 py-20">
<div className="max-w-7xl mx-auto flex flex-col md:flex-row items-center justify-between gap-8"> <div className="max-w-7xl mx-auto flex flex-col md:flex-row items-center justify-between gap-8">
<h2 className="font-display font-black text-4xl sm:text-5xl lg:text-6xl uppercase text-[#0A0A0A] leading-[0.9]"> <h2 className="font-display font-black text-4xl sm:text-5xl lg:text-6xl text-[#0A0A0A] leading-[0.9]">
Ready to build<br /> ready to build<br />
<span className="text-stroke">the impossible?</span> <span className="text-stroke">the impossible?</span>
</h2> </h2>
<Link <Link