SEO untuk Multi-language
Tanpa setup SEO yang benar, Google bisa mengindex versi bahasa yang salah untuk user, atau bahkan menganggap konten multi-bahasa sebagai duplicate content.
URL Strategy
// 3 opsi utama untuk URL multi-bahasa:
// 1. Subdirectory (RECOMMENDED)
https://example.com/id/about
https://example.com/en/about
// ✅ Mudah di-setup, satu domain, shared domain authority
// 2. Subdomain
https://id.example.com/about
https://en.example.com/about
// ⚠️ Perlu setup DNS, domain authority terpisah
// 3. Country-code TLD
https://example.id/about
https://example.com/about
// ⚠️ Mahal, maintenance tinggi, tapi sinyal geo paling kuat
hreflang Tags
<!-- WAJIB di setiap halaman multi-bahasa -->
<head>
<!-- Self-referencing hreflang -->
<link rel="alternate" hreflang="id" href="https://example.com/id/about" />
<link rel="alternate" hreflang="en" href="https://example.com/en/about" />
<link rel="alternate" hreflang="ja" href="https://example.com/ja/about" />
<!-- x-default: fallback untuk bahasa yang tidak didukung -->
<link rel="alternate" hreflang="x-default" href="https://example.com/en/about" />
</head>
<!-- React/Next.js -->
import Head from "next/head";
function SEOHead({ currentLocale, path, locales }) {
return (
<Head>
{locales.map((locale) => (
<link
key={locale}
rel="alternate"
hreflang={locale}
href={`https://example.com/${locale}${path}`}
/>
))}
<link rel="alternate" hreflang="x-default"
href={`https://example.com/en${path}`} />
</Head>
);
}
Sitemap Multi-language
<!-- sitemap.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://example.com/id/about</loc>
<xhtml:link rel="alternate" hreflang="id" href="https://example.com/id/about" />
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/about" />
<xhtml:link rel="alternate" hreflang="ja" href="https://example.com/ja/about" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/about" />
</url>
</urlset>
Canonical URL
<!-- Setiap versi bahasa punya canonical sendiri -->
<!-- ✅ BENAR -->
<!-- Halaman /id/about: -->
<link rel="canonical" href="https://example.com/id/about" />
<!-- Halaman /en/about: -->
<link rel="canonical" href="https://example.com/en/about" />
<!-- ❌ SALAH: jangan point semua bahasa ke satu canonical -->
<link rel="canonical" href="https://example.com/about" />
Open Graph per Bahasa
<meta property="og:locale" content="id_ID" />
<meta property="og:locale:alternate" content="en_US" />
<meta property="og:locale:alternate" content="ja_JP" />
<meta property="og:title" content="Tentang Kami — Example" />
<meta property="og:description" content="Pelajari lebih lanjut tentang Example." />
Content-Language Header
// Server-side: kirim header Content-Language
// Laravel
return response($content)
->header("Content-Language", app()->getLocale());
// Express
res.set("Content-Language", req.locale);
// HTML meta (fallback)
<meta http-equiv="Content-Language" content="id" />