Add comprehensive SEO support for property listing pages to improve organic search visibility and social sharing. Changes: - Convert listing detail page from client-only to server component wrapper with generateMetadata() for per-listing title, description, OG tags, canonical URLs, and hreflang alternates - Add JSON-LD structured data (Schema.org RealEstateListing) with price, location, property specs, and breadcrumb markup - Add Website JSON-LD with SearchAction to root layout - Upgrade sitemap.xml to dynamically include all active listings across both locales (vi, en) with ISR revalidation - Improve robots.txt with pagination/sort exclusions and GPTBot block - Create server-side fetch utility (listings-server.ts) for SSR data - Extract client UI into ListingDetailClient component Co-Authored-By: Paperclip <noreply@paperclip.ing>
29 lines
696 B
TypeScript
29 lines
696 B
TypeScript
import type { MetadataRoute } from 'next';
|
|
|
|
const siteUrl = process.env['NEXT_PUBLIC_SITE_URL'] || 'https://goodgo.vn';
|
|
|
|
export default function robots(): MetadataRoute.Robots {
|
|
return {
|
|
rules: [
|
|
{
|
|
userAgent: '*',
|
|
allow: '/',
|
|
disallow: [
|
|
'/dashboard/',
|
|
'/admin/',
|
|
'/auth/',
|
|
'/api/',
|
|
'/*?sort=', // avoid indexing duplicate sort-order pages
|
|
'/*?page=', // avoid indexing deep pagination pages
|
|
],
|
|
},
|
|
{
|
|
userAgent: 'GPTBot',
|
|
disallow: ['/'], // block AI crawlers if desired
|
|
},
|
|
],
|
|
sitemap: `${siteUrl}/sitemap.xml`,
|
|
host: siteUrl,
|
|
};
|
|
}
|