## 11. SEO — Metadata, JSON-LD, OG Images

### Metadata Builder

ของจริงมี helper function ที่ reuse ได้:

```tsx
// src/lib/seo.ts
export const siteConfig = {
  name: "MIMO",
  url: "https://mimoth.com",
  title: "MIMO | AI Tools Thailand",
  description: "MIMO คือคลังเครื่องมือ AI ภาษาไทยสำหรับค้นหา เปรียบเทียบ...",
  locale: "th_TH",
  language: "th-TH",
};

export function buildMetadata({ title, description, path, image, type, noIndex }) {
  const url = absoluteUrl(path);
  return {
    title,
    description,
    alternates: { canonical: url },
    openGraph: {
      title: `${title} | ${siteConfig.name}`,
      description, url, siteName: siteConfig.name,
      locale: siteConfig.locale, type,
      images: [{ url: image || defaultSocialImage, width: 1200, height: 630 }],
    },
    twitter: { card: "summary_large_image", title, description, images: [image || defaultSocialImage] },
    robots: noIndex ? { index: false, follow: false } : { index: true, follow: true },
  };
}
```

### JSON-LD Helpers

```tsx
createWebsiteJsonLd()        // WebSite schema — หน้า Home
createItemListJsonLd(name, path, items)  // ItemList — Tools, Guides, News listing
createToolJsonLd(tool)       // SoftwareApplication — tool detail
createGuideArticleJsonLd(guide) // Article + FAQ — guide detail
createNewsArticleJsonLd(article) // NewsArticle —ข่าว detail
```

### Usage ในแต่ละหน้า

```tsx
// tools/page.tsx
export const metadata = buildMetadata({
  title: "AI Tools Directory ภาษาไทย",
  description: "ค้นหาและกรองเครื่องมือ AI...",
  path: "/tools",
});

// ใน JSX
<JsonLd data={createItemListJsonLd("MIMO AI Tools Directory", "/tools", toolItems)} />
```

### OG Image (Dynamic)

ของจริงใช้ Next.js OG image generation ที่ `/opengraph-image.tsx` — สร้างภาพ 1200×630 แบบ dynamic