feat: implement programmatic SEO routes and optimize meta tags

This commit is contained in:
mstfyldz
2026-05-30 22:02:55 +03:00
parent fa9e3edcd8
commit 7872e8862d
16 changed files with 947 additions and 629 deletions
+49
View File
@@ -0,0 +1,49 @@
import { getDictionary } from "@/get-dictionary";
import type { Locale } from "@/i18n-config";
import WorkClient from "@/components/WorkClient";
import { getProjects } from "@/app/actions";
import { slugify } from "@/lib/utils";
import { notFound } from "next/navigation";
export async function generateMetadata({ params }: { params: Promise<{ lang: Locale, slug: string }> }) {
const { lang, slug } = await params;
const dict = await getDictionary(lang);
const projects = await getProjects();
const filteredProjects = projects.filter((p: any) => slugify(p.tag) === slug);
if (filteredProjects.length === 0) return { title: "Not Found" };
const tagName = filteredProjects[0].tag;
const titleStr = lang === "tr" ? `${tagName} Ajansı` : `${tagName} Agency`;
return {
title: `${titleStr} | ${dict.nav.brandName}`,
description: `${titleStr} - ${dict.work.desc}`,
};
}
export default async function ExpertisePage({ params }: { params: Promise<{ lang: Locale, slug: string }> }) {
const { lang, slug } = await params;
const dict = await getDictionary(lang);
const projects = await getProjects();
const filteredProjects = projects.filter((p: any) => slugify(p.tag) === slug);
if (filteredProjects.length === 0) {
notFound();
}
const tagName = filteredProjects[0].tag;
const titleStr = lang === "tr" ? `${tagName} Ajansı` : `${tagName} Agency`;
// Clone dict to overwrite the work title specifically for this page
const customDict = {
...dict,
work: {
...dict.work,
title: titleStr
}
};
return <WorkClient lang={lang} dict={customDict} initialProjects={filteredProjects} />;
}