feat(ssg): add ISR (revalidate=60) for dynamic database pages to keep data fresh
This commit is contained in:
@@ -4,6 +4,8 @@ import { getBlogPosts } from "@/app/actions";
|
||||
import BlogDetailClient from "@/components/BlogDetailClient";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
// Convert DB format to expected BlogPost format
|
||||
function mapBlogPost(dbPost: any) {
|
||||
return {
|
||||
|
||||
@@ -3,6 +3,8 @@ import type { Locale } from "@/i18n-config";
|
||||
import BlogClient from "@/components/BlogClient";
|
||||
import { getBlogPosts } from "@/app/actions";
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export async function generateMetadata({ params }: { params: Promise<{ lang: Locale }> }) {
|
||||
const { lang } = await params;
|
||||
const dict = await getDictionary(lang);
|
||||
|
||||
@@ -5,6 +5,8 @@ import { getProjects } from "@/app/actions";
|
||||
import { slugify } from "@/lib/utils";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export async function generateMetadata({ params }: { params: Promise<{ lang: Locale, slug: string }> }) {
|
||||
const { lang, slug } = await params;
|
||||
const dict = await getDictionary(lang);
|
||||
|
||||
@@ -4,6 +4,8 @@ import WorkDetailClient from "@/components/WorkDetailClient";
|
||||
import { notFound } from "next/navigation";
|
||||
import { getProjects } from "@/app/actions";
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
// ── Static params for all slug × lang combinations ──
|
||||
export async function generateStaticParams() {
|
||||
const langs: Locale[] = ["en", "tr"];
|
||||
|
||||
@@ -3,6 +3,8 @@ import type { Locale } from "@/i18n-config";
|
||||
import WorkClient from "@/components/WorkClient";
|
||||
import { getProjects } from "@/app/actions";
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export async function generateMetadata({ params }: { params: Promise<{ lang: Locale }> }) {
|
||||
const { lang } = await params;
|
||||
const dict = await getDictionary(lang);
|
||||
|
||||
Reference in New Issue
Block a user