どのように へ Implement Hreflang (手順 by 手順)

暫定日本語訳:機能 code 向けに all three hreflang 方法 — HTML head tags, HTTP Link headers, と XML sitemap annotations — plus syntax rules, at-scale CMS automation, と validation workflow へ confirm it actually shipped correctly.

初回公開:2026年7月2日 · 最終更新:2026年8月4日 · Advanced
言語
このページには証拠シグナルが1件あります

暫定日本語訳:There are exactly three ways へ 追加 hreflang — HTML link tags in head, HTTP Link レスポンス headers (向けに non-HTML files like PDFs), または xhtml:link entries in XML sitemap (best at scale). Pick one; Google treats all three as equivalent と there's no benefit へ combining them. すべての 方法 obeys 同じ two non-negotiable rules: self-reference (各 ページ lists itself) と reciprocity (if points へ B, B 必要がある point back へ, または Google ignores pair). Codes are ISO 639-1 言語 plus optional ISO 3166-1 alpha-2 地域; x-デフォルト is fallback. Generate it all から single ソース of truth, then validate rendered head, ない just view-ソース — in my study of 374 756 domains, 超えて 67% of hreflang setups had at least one 問題.

暫定日本語案: TL;DR — Three 方法, pick one: HTML <link> tags in <head>, HTTP 暫定日本語案: Link: headers ( だけ option 向けに non-HTML files like PDFs), または <xhtml:link> 暫定日本語案: entries in XML sitemap (best at scale — one machine-generated file, easiest へ 暫定日本語案: QA). Google says three are equivalent と there’s no benefit へ combining 暫定日本語案: them. すべての 方法 obeys self-reference + reciprocity, 使用 absolute URLs, と 暫定日本語案: 使用 ISO 639-1 言語 + optional ISO 3166-1 alpha-2 地域 codes. Generate 暫定日本語案: whole thing から one ソース of truth — hand-maintained hreflang rots. Then 暫定日本語案: validate rendered head, クロール whole cluster 向けに reciprocity, と 保つ 暫定日本語案: re-確認 後に すべての URL change. Do ない auto-リダイレクト crawlers by geo.

前に あなた write line of code: three decisions

暫定日本語案: 1. Which 方法. Google is explicit その choice is について convenience, ない 暫定日本語案: パフォーマンス — “The three methods are equivalent from Google’s perspective and you can choose the method that’s the most convenient for your site.” My rough rule:

Evidence for this claim Google supports equivalent HTML, HTTP-header, and sitemap methods for declaring localized versions; HTTP headers can be used for non-HTML files such as PDFs. Scope: Google Search hreflang implementation methods. Confidence: high · Verified: Google: Localized versions
  • 暫定日本語案: handful of URLs, static または simple サイト, few locales → HTML <link> tags.
  • 暫定日本語案: Non-HTML assets (PDFs, docs) → HTTP Link: headers (あなた have no other 暫定日本語案: option — there’s no <head> in PDF).
  • 暫定日本語案: Many locales, existing sitemap pipeline, または headless/JAMstack setup → 暫定日本語案: XML sitemap, generated programmatically.

暫定日本語案: Decision Trees lens walks この as actual flowchart.

暫定日本語案: 2. One ソース of truth. Whatever 方法 あなた pick, annotations すべき be 暫定日本語案: generated から one place — locale/translation table in あなた database, CMS 暫定日本語案: relationship field, または (向けに small サイト) single spreadsheet. single worst 暫定日本語案: hreflang anti-pattern is hand-maintaining tags per ページ. moment one locale’s 暫定日本語案: template drifts, return links go 不足している と pairs get dropped.

暫定日本語案: 3. Do ない combine 方法. あなた できる run all three; Google says there’s no 暫定日本語案: benefit, と すべての extra 方法 is another surface 向けに three copies へ disagree 暫定日本語案: とともに 各 other.

Evidence for this claim Google requires fully qualified alternate URLs and reciprocal links, and recommends including each page itself in its alternate set. Scope: Google Search hreflang rules shared by all delivery methods. Confidence: high · Verified: Google: Hreflang guidelines

暫定日本語案: syntax, verbatim から Google, is:

<link rel="alternate" hreflang="lang_code" href="url_of_page" />

暫定日本語案: full 機能 設定 向けに multi-言語, multi-地域 cluster とともに fallback:

<link rel="alternate" hreflang="en-us" href="https://example.com/us/" />
<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

暫定日本語案: その exact block goes on すべての ページ in cluster ( US ページ, UK ページ, 暫定日本語案: German ページ, と homepage) — 各 one 含む its own self-referencing 暫定日本語案: line. その’s 何 satisfies reciprocity.

暫定日本語案: Placement is hard rule. Google: “The <link> tags must be inside a well-formed <head> section of the HTML.” と their own troubleshooting advice: 暫定日本語案: “If in doubt, paste code from your rendered page into an HTML validator to ensure that the links are inside the <head> element.”

暫定日本語案: この matters more than it sounds, because of failure mode 大半の written guides 暫定日本語案: skip: hreflang tags できる be forced out of <head> と へ <body>, 暫定日本語案: どこ それら’re 無効. In my Pubcon Vegas 2019 deck 暫定日本語案: I flagged この directly — tags できる’t legitimately live in body (その する let 暫定日本語案: one サイト hijack another’s alternates), ただし malformed または injected <p> tag, または 暫定日本語案: iframe, できる prematurely close <head> so その everything 後に it — including 暫定日本語案: あなた hreflang — renders inside <body>. tag is technically present in 暫定日本語案: ソース ただし silently 無効. fastest way へ debug it is ブラウザー DOM 暫定日本語案: breakpoints: watch どこ tags actually land in rendered DOM, then walk 暫定日本語案: back へ markup その broke <head>.

暫定日本語案: いつ HTML tags 作る sense: small-へ-medium サイト とともに manageable number of 暫定日本語案: locales, どこ per-ページ <link> block doesn’t balloon. On サイト とともに dozens 暫定日本語案: of locales, すべての ページ carries large block of markup — which is one 理由 big 暫定日本語案: サイト lean on sitemap 方法.

暫定日本語案: Don’t mix hreflang とともに other alternate attributes on 同じ 暫定日本語案: <link> element. Google’s guidance is explicit その <link rel="alternate"> 暫定日本語案: carrying hreflang shouldn’t また carry unrelated alternate attribute like 暫定日本語案: media in 同じ tag — if あなた need both 言語/地域 alternate と 暫定日本語案: media-クエリ alternate 向けに 同じ URL, その’s two separate <link> elements, 暫定日本語案: ない one combined one. Mixing them is easy way へ end up とともに tag Google 暫定日本語案: できる’t parse as either.

暫定日本語案: 同じ information, sent in HTTP レスポンス instead of HTML. syntax:

Link: <https://example.com/file.pdf>; rel="alternate"; hreflang="en",
      <https://de-ch.example.com/file.pdf>; rel="alternate"; hreflang="de-ch"

暫定日本語案: Note angle brackets around 各 URL, semicolon-separated attributes, と 暫定日本語案: comma separating 各 alternate. すべての URL in header is comma-appended.

暫定日本語案: いつ あなた need この: non-HTML resources. PDF, .doc, 画像 served 暫定日本語案: directly — none of them have <head> へ hold <link> tags, so header is 暫定日本語案: あなた だけ way へ attach hreflang へ them.

暫定日本語案: Configuration considerations: あなた 設定 これらの headers at サーバー または CDN layer 暫定日本語案: ( Apache Header directive, Nginx add_header, Cloudflare/Fastly/CloudFront 暫定日本語案: レスポンス-header rule, または あなた application’s レスポンス). Because header is 設定 by 暫定日本語案: infrastructure rather than per-document markup, reciprocity rule is easy へ 暫定日本語案: break here — English PDF’s header と German PDF’s header are usually 暫定日本語案: 設定 separately, so it’s on あなた へ 作る sure 各 one lists whole 設定, 暫定日本語案: itself 含む. 保つ header generation driven by 同じ locale table as あなた 暫定日本語案: HTML/sitemap approach.

暫定日本語案: ** invariant へ hold onto: すべての alternate レスポンス carries identical 暫定日本語案: 完全な 設定, すべての time.** It’s ない enough 向けに English PDF’s header へ list 暫定日本語案: German alternate — German PDF’s レスポンス has へ carry exact 同じ 暫定日本語案: 設定 back (itself plus すべての other alternate), on すべての single レスポンス, ない just 暫定日本語案: 最初 one crawler happens へ hit. Treat header as generated output, ない 暫定日本語案: one-off あなた 設定 と forget.

暫定日本語案: At scale, この is usually right call: whole cluster lives in one (または few) 暫定日本語案: machine-generated files, nothing bloats 各 ページ’s <head>, と — because 暫定日本語案: entire relationship graph is in one place — it’s by far easiest 方法 へ QA. 暫定日本語案: syntax:

<?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://www.example.com/english/page.html</loc>
    <xhtml:link rel="alternate" hreflang="de"
                href="https://www.example.de/deutsch/page.html"/>
    <xhtml:link rel="alternate" hreflang="en"
                href="https://www.example.com/english/page.html"/>
  </url>
  <url>
    <loc>https://www.example.de/deutsch/page.html</loc>
    <xhtml:link rel="alternate" hreflang="de"
                href="https://www.example.de/deutsch/page.html"/>
    <xhtml:link rel="alternate" hreflang="en"
                href="https://www.example.com/english/page.html"/>
  </url>
</urlset>

暫定日本語案: Two things その trip 人々 up in sitemap 方法:

  1. 暫定日本語案: ** namespace declaration is mandatory.** その 暫定日本語案: xmlns:xhtml="http://www.w3.org/1999/xhtml" on <urlset> element is ない 暫定日本語案: optional decoration — omit it と すべての <xhtml:link> in file is 無効.
  2. 暫定日本語案: すべての <url> block 必要がある be self-完全な. Notice その both <url> blocks 暫定日本語案: above list both alternates, including their own <loc>. 各 <url> entry 暫定日本語案: carries full 設定 (self-reference + all alternates). Reciprocity in sitemap 暫定日本語案: is just “every URL’s block lists every URL in the cluster, itself included.”

暫定日本語案: Two behaviors worth knowing so あなた don’t 超えて-engineer generator: order 暫定日本語案: of <xhtml:link> children inside <url> block doesn’t matter へ Google — 暫定日本語案: don’t waste time sorting them — と それらの <xhtml:link> annotations don’t count 暫定日本語案: against あなた sitemap’s 50 000-URL-per-file limit, since それら’re children of 暫定日本語案: <url> entry, ない separate <url> entries themselves.

暫定日本語案: Generating it programmatically. whole point of sitemap 方法 is その 暫定日本語案: it’s byproduct of あなた CMS’s own translation データ. If あなた CMS already knows 暫定日本語案: その /english/page.html/deutsch/page.html are translations of 各 other, 暫定日本語案: あなた sitemap generator すべき walk その relationship table と emit 暫定日本語案: <xhtml:link> blocks at 構築 time (または at sitemap-リクエスト time). Do その と 暫定日本語案: hreflang できる’t drift out of sync とともに reality — it’s regenerated から ソース of 暫定日本語案: truth すべての time, と adding locale is データ change, ない hand-edit 全体で 暫定日本語案: hundreds of ページ.

暫定日本語案: 向けに teams なしで dev resources, I built lightweight 暫定日本語案: Google Sheets template in my Ahrefs 暫定日本語案: hreflang guide: Setup tab (pick デフォルト 言語 plus up へ four variants), 暫定日本語案: URLs tab (paste 各 言語’s URLs へ columns), と Results tab その 暫定日本語案: auto-generates sitemap XML block 向けに あなた. It’s “single source of truth” idea 暫定日本語案: made concrete 向けに サイト too small へ justify real CMS integration.

rules その apply no matter which 方法 あなた pick

暫定日本語案: これらの are 方法-agnostic と non-negotiable.

  • 暫定日本語案: Self-reference. すべての ページ (または すべての <url> block, または すべての header) lists 暫定日本語案: itself. Mueller frames この as optional-ただし-good-practice, ただし skipping it was 暫定日本語案: present in 18,0% of domains in my study — automate it と it costs nothing.
  • 暫定日本語案: Reciprocity. “Each language version must list itself as well as all other language versions.” と enforcement: “If two pages don’t both point to each other, the tags will be ignored. This is so that someone on another site can’t arbitrarily create a tag naming itself as an alternative version of one of your pages.” One 不足している return link drops pair.
  • 暫定日本語案: Absolute, fully-qualified URLs. “Alternate URLs must be fully-qualified, including the transport method (http/https)” — so https://example.com/foo, 暫定日本語案: 決して //example.com/foo または /foo. と URL 必要がある match exact form 暫定日本語案: Google indexes: protocol, www, trailing slash, と ケース all have へ line up, または 暫定日本語案: return-link match fails.

Getting codes right

暫定日本語案: “The first code of the hreflang attribute is the language code (in ISO 639-1 format) followed by an optional second code that represents the region code (in ISO 3166-1 Alpha 2 format).” Combine them とともに dash: en-US. あなた できる target 暫定日本語案: 言語 on its own (es = Spanish everywhere), ただし あなた cannot target 地域 暫定日本語案: on its own — there’s 常に 言語 最初.

暫定日本語案: mistakes I see 大半の 多くの場合 (と saw 全体で study dataset):

  • 暫定日本語案: en-UK instead of en-GBuk is Ukrainian, UK’s 地域 code is gb.
  • 暫定日本語案: jp instead of ja 向けに Japanese, cn instead of zh 向けに Chinese.
  • 暫定日本語案: Three-letter codes (ger, eng) どこ two-letter ISO 639-1 is 必要.
  • 暫定日本語案: Using EU, UN, または UK as 地域 codes — none are 有効 ISO 3166-1 alpha-2 暫定日本語案: targets.

暫定日本語案: x-default is reserved value 向けに fallback — 言語 selector または 暫定日本語案: auto-redirecting home ページ その serves ユーザー who match none of あなた explicit 暫定日本語案: locales:

<link rel="alternate" href="https://example.com/" hreflang="x-default" />

暫定日本語案: It’s ない mandatory. It was single 大半の-不足している element in my study (56,3% of 暫定日本語案: domains omitted it), ただし 不足している x-default doesn’t break cluster way 暫定日本語案: 不足している reciprocal tag does — Google just falls back へ its own 言語/地域 暫定日本語案: detection 向けに unmatched ユーザー. 追加 it anyway; it’s 確認 item, ない 暫定日本語案: cluster-breaker. (There’s dedicated x-デフォルト subtopic in この cluster.)

Implementing at scale — CMS と プラットフォーム approaches

暫定日本語案: WordPress. Yoast SEO does ない generate hreflang on its own. へ actually 暫定日本語案: output tags あなた need multilingual plugin — WPML または Polylang. WPML 暫定日本語案: auto-generates hreflang 向けに すべての ページ その has translations, adds x-default 暫定日本語案: pointing at あなた デフォルト-言語 version, と by デフォルト injects annotations 暫定日本語案: へ XML sitemap; there’s 設定 下で WPML → 言語 → SEO Options 暫定日本語案: (“Display alternative languages in the HEAD section”) if あなた want head-tag output 暫定日本語案: instead of, または in addition へ, sitemap. (See WPML’s docs on using it とともに 暫定日本語案: Yoast.)

暫定日本語案: Shopify. Shopify Markets 自動 generates mutually-linked hreflang 暫定日本語案: tags once あなた’ve 設定 markets/言語 と コンテンツ is published と 暫定日本語案: linked in navigation — which removes 大半の 一般的な failure mode (不足している 暫定日本語案: reciprocal links) by design. catch: Markets’ 自動 tags are 多くの場合 暫定日本語案: 言語-だけ (fr, de) rather than 言語-地域 (fr-FR, fr-CA), which 暫定日本語案: 下で-serves brands その need regional specificity — French 向けに France vs. Canada 暫定日本語案: vs. Belgium. 向けに その あなた drop へ 手動 <link> tags in theme.liquid (Shopify’s 暫定日本語案: own theme hreflang docs 暫定日本語案: 表示 pattern) または app — と be careful, because mixing 自動 Markets 暫定日本語案: tags とともに 手動/app tags is documented ソース of conflicts. Pick one.

暫定日本語案: カスタム / headless / enterprise. Generate annotations から あなた 暫定日本語案: translation-relationship table at 構築 または serve time, as described in sitemap 暫定日本語案: section above. この is 同じ “single source of truth” principle — hreflang 暫定日本語案: becomes computed output of データ あなた CMS already holds, ない hand-maintained 暫定日本語案: artifact その できる rot.

Implementation mistakes その break cluster

暫定日本語案: Auto-redirecting by geo/IP. この is separate failure から syntax errors と 暫定日本語案: it’s worse. If あなた リダイレクト 訪問者 — と especially crawlers — へ version based 暫定日本語案: on perceived ロケーション, あなた できる de-インデックス登録 entire regional clusters, because Googlebot 暫定日本語案: mostly crawls から US. As I put it in その Pubcon deck: geo-リダイレクト “would redirect search engines to where they crawl from. Google for instance mostly crawls from the US so we would effectively de-index all geo pages.” There’s regulatory 暫定日本語案: angle too — potential exposure 下で EU anti-geoblocking rules. right pattern is 暫定日本語案: リダイレクト ユーザー, 決して crawlers: detect と (optionally) リダイレクト human 訪問者, 暫定日本語案: ただし 常に let bots reach すべての URL variant directly, とともに hreflang doing actual 暫定日本語案: routing signal. Google’s own multi-regional guidance 暫定日本語案: recommends non-intrusive suggestion banner 超えて 自動 redirection 向けに exactly 暫定日本語案: この 理由.

暫定日本語案: Pointing hreflang at non-canonical, リダイレクト, または noindexed URLs. If locale’s 暫定日本語案: URL changes と リダイレクト goes in ただし hreflang still points at 古い URL, 暫定日本語案: あなた cluster 現在 references 301 または 404 (16,9% of domains in my study 暫定日本語案: referenced broken/リダイレクト ページ). Similarly, 各 variant すべき canonicalize へ 暫定日本語案: itself; pointing hreflang at URL その’s canonicalized away, または at noindexed 暫定日本語案: ページ, breaks return link (8,0% pointed at non-canonical URLs).

暫定日本語案: Inconsistent URL formats. hreflang URL と インデックス登録 URL have へ be 暫定日本語案: byte-identical in form — trailing slash, www, protocol, と ケース all 含む. 暫定日本語案: mismatch here is silent reciprocity failure.

Validating あなた implementation 後に launch

暫定日本語案: View rendered ソース, ない just raw ソース. If あなた hreflang is injected by 暫定日本語案: クライアント-side JavaScript, curl または Ctrl+U (“View Page Source”) する 表示 nothing — 暫定日本語案: ただし tags exist in rendered DOM. Confirm とともに GSC URL Inspection → “Test Live URL” → “View Tested Page,” または rendering-capable crawler. この is single 大半の 暫定日本語案: 一般的な 理由 someone says “my tags are missing” いつ それら’re actually fine (または 暫定日本語案: reverse — present in ソース ただし broken because それら render in <body>).

暫定日本語案: クロール whole cluster, don’t spot-確認 one URL. Reciprocity is 暫定日本語案: relationship 間に ページ, so 確認 one ページ tells あなた almost nothing. Run 暫定日本語案: crawler 全体で whole cluster — Screaming Frog’s 暫定日本語案: hreflang audit 暫定日本語案: または Ahrefs サイト Audit — へ catch 不足している return tags, non-canonical targets, と 暫定日本語案: broken references at scale. Ahrefs サイト Audit’s Hreflangs tab draws cluster as 暫定日本語案: graph とともに broken links in red, which is far easier へ 理由 について than CSV.

暫定日本語案: Verify real SERPs とともに &hl=&gl=. Append host-言語 (&hl=) と 暫定日本語案: geolocation (&gl=) パラメーター へ Google 検索 URL へ preview 何 given 暫定日本語案: locale’s results actually look like, rather than guessing から あなた own ロケーション.

暫定日本語案: Validation is ない one-time 手順. 新しい locales, URL/リダイレクト changes, と 暫定日本語案: dev/staging config bleeding へ production are recurring causes of post-launch 暫定日本語案: breakage. 構築 hreflang checks へ regression tests と recurring crawls, ない just 暫定日本語案: launch-day QA pass. My framing から talks: “any number of things can break from masking to things carrying over from dev/test/staging environments.”

Myths worth retiring

  • 暫定日本語案: “Sitemaps process faster than HTML tags.” False. Both are resolved at クロール 暫定日本語案: time — I’ve debunked この directly. sitemap’s advantage is maintainability と 暫定日本語案: QA, ない speed.
  • 暫定日本語案: “Yandex doesn’t support hreflang in sitemaps.” False — Yandex’s own 暫定日本語案: ドキュメント confirms sitemap hreflang support.
  • 暫定日本語案: “Use all three methods for extra signal.” No benefit per Google, と it just 暫定日本語案: multiplies inconsistency risk.
  • 暫定日本語案: “A missing x-default breaks the cluster.” False — it’s optional; Google 暫定日本語案: falls back へ its own detection.
  • 暫定日本語案: “Wrong hreflang gets you penalized.” False — it’s hint, ない directive. 暫定日本語案: Broken hreflang is ignored, ない penalized.

どこ へ go next

暫定日本語案: この 記事 is どのように-へ depth 下で hreflang hub — hub covers 何 暫定日本語案: hreflang is, なぜ reciprocity matters, と 何 Bing does instead. x-デフォルト 暫定日本語案: subtopic goes deep on fallback value. 向けに strategy この implements, see 暫定日本語案: International SEO pillar — hreflang is technical layer, ない 暫定日本語案: substitute 向けに genuine localization.

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin a quote first.