From 3908ddc765b78fd0c9d98ec355d234f8da73edf6 Mon Sep 17 00:00:00 2001 From: Kunthawat Greethong Date: Sat, 28 Feb 2026 14:49:18 +0700 Subject: [PATCH] Add complete SEO content for all 36 product pages - Add keywords, seoContent, specifications, features, FAQ, and Schema.org data - Extend types for ProductSpecification and FAQItem - Update product page to render SEO sections with structured data - All content in Thai for Thai market SEO optimization --- src/app/[...slug]/page.tsx | 427 ++++++++--- src/data/site-config.ts | 1463 +++++++++++++++++++++++++++++++++++- src/types/index.ts | 33 + 3 files changed, 1785 insertions(+), 138 deletions(-) diff --git a/src/app/[...slug]/page.tsx b/src/app/[...slug]/page.tsx index e6ce882fa..8be8c8251 100644 --- a/src/app/[...slug]/page.tsx +++ b/src/app/[...slug]/page.tsx @@ -2,7 +2,7 @@ import { notFound } from 'next/navigation'; import Image from 'next/image'; import Link from 'next/link'; import { productCategories, portfolioProjects } from '@/data/site-config'; - +import type { ProductCategory, FAQItem } from '@/types'; interface Props { params: { slug: string[] }; @@ -30,7 +30,7 @@ export async function generateStaticParams() { type ContentType = 'product' | 'portfolio'; -function findContentBySlug(slug: string[]): { type: ContentType; data: typeof productCategories[0] | typeof portfolioProjects[0] } | null { +function findContentBySlug(slug: string[]): { type: ContentType; data: ProductCategory | typeof portfolioProjects[0] } | null { // Decode URL-encoded slug parts const decodedSlug = slug.map(part => decodeURIComponent(part)); const fullPath = '/' + decodedSlug.join('/') + '/'; @@ -60,11 +60,21 @@ export async function generateMetadata({ params }: Props) { const { type, data } = content; if (type === 'product') { - const product = data as typeof productCategories[0]; + const product = data as ProductCategory; + const title = product.keywords?.[0] + ? `${product.name} | ${product.keywords[0]} - ดีลพลัสเทค` + : `${product.name} - ${product.nameEn} | ดีลพลัสเทค`; + return { - title: `${product.name} - ${product.nameEn}`, + title, description: product.description, - keywords: product.keywords, + keywords: product.keywords?.join(', '), + openGraph: { + title: product.name, + description: product.description, + images: [product.image], + type: 'website', + }, }; } @@ -74,6 +84,68 @@ export async function generateMetadata({ params }: Props) { }; } +// Schema.org JSON-LD for Products +function ProductSchema({ product }: { product: ProductCategory }) { + const schema = { + '@context': 'https://schema.org', + '@type': 'Product', + name: product.name, + description: product.description, + image: product.image, + brand: { + '@type': 'Brand', + name: product.schemaData?.brand || product.nameEn, + }, + manufacturer: { + '@type': 'Organization', + name: product.schemaData?.manufacturer || 'ดีลพลัสเทค', + }, + ...(product.schemaData?.sku && { sku: product.schemaData.sku }), + ...(product.schemaData?.mpn && { mpn: product.schemaData.mpn }), + ...(product.schemaData?.material && { material: product.schemaData.material }), + category: product.schemaData?.category || 'Industrial Pipe & Equipment', + offers: { + '@type': 'Offer', + availability: 'https://schema.org/InStock', + priceCurrency: 'THB', + seller: { + '@type': 'Organization', + name: 'ดีลพลัสเทค', + }, + }, + }; + + return ( +