feat(web): add SEO optimization — JSON-LD, dynamic sitemap, meta tags for listings

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>
This commit is contained in:
Ho Ngoc Hai
2026-04-10 20:38:28 +07:00
parent 05abbc5250
commit 50c5168529
7 changed files with 756 additions and 359 deletions

View File

@@ -1,16 +1,28 @@
import type { MetadataRoute } from 'next';
export default function robots(): MetadataRoute.Robots {
const siteUrl = process.env['NEXT_PUBLIC_SITE_URL'] || 'https://goodgo.vn';
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/'],
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,
};
}