Add SEO improvements: sitemap, robots.txt, LocalBusiness schema, GA4, llm.txt

- Add dynamic sitemap.xml generation for all pages
- Add robots.txt for search engine crawl directives
- Add LocalBusiness JSON-LD schema for local SEO
- Add BreadcrumbList schema for navigation breadcrumbs
- Add canonical URLs to all product pages
- Add Twitter Cards metadata
- Add Google Analytics 4 integration component
- Create llm.txt with all product data for AI optimization
- Create reusable UI components (Button, Card, Badge)
- Update company address to full Thai address
- Update .env.example with GA4 placeholder
This commit is contained in:
Kunthawat Greethong
2026-02-28 18:10:09 +07:00
parent 3908ddc765
commit 13436b42e5
12 changed files with 923 additions and 2 deletions

View File

@@ -69,11 +69,15 @@ export async function generateMetadata({ params }: Props) {
title,
description: product.description,
keywords: product.keywords?.join(', '),
alternates: {
canonical: product.href,
},
openGraph: {
title: product.name,
description: product.description,
images: [product.image],
type: 'website',
url: `https://dealplustech.co.th${product.href}`,
},
};
}
@@ -123,6 +127,41 @@ function ProductSchema({ product }: { product: ProductCategory }) {
);
}
// BreadcrumbList Schema for SEO
function BreadcrumbSchema({ product }: { product: ProductCategory }) {
const schema = {
'@context': 'https://schema.org',
'@type': 'BreadcrumbList',
itemListElement: [
{
'@type': 'ListItem',
position: 1,
name: 'หน้าแรก',
item: 'https://dealplustech.co.th',
},
{
'@type': 'ListItem',
position: 2,
name: 'สินค้า',
item: 'https://dealplustech.co.th/product/',
},
{
'@type': 'ListItem',
position: 3,
name: product.name,
item: `https://dealplustech.co.th${product.href}`,
},
],
};
return (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}
/>
);
}
// FAQ Schema for SEO
function FAQSchema({ faq }: { faq: FAQItem[] }) {
const schema = {
@@ -177,8 +216,8 @@ function ProductPage({ product }: { product: ProductCategory }) {
<>
{/* Schema.org Structured Data */}
<ProductSchema product={product} />
<BreadcrumbSchema product={product} />
{product.faq && product.faq.length > 0 && <FAQSchema faq={product.faq} />}
<div className="pt-24 pb-16">
<div className="container mx-auto px-4">
{/* Breadcrumb */}