Hreflang 標籤產生器
為多語言和多地區網站產生 hreflang 標籤。支持 HTML 連結標籤、HTTP 標頭和 XML 網站地圖格式,具備內建驗證與智慧網址自動填充功能。
<link rel="alternate" hreflang="en" href="https://example.com/product" /> <link rel="alternate" hreflang="ja" href="https://example.com/ja/product" /> <link rel="alternate" hreflang="ko" href="https://example.com/ko/product" /> <link rel="alternate" hreflang="zh-hans" href="https://example.com/zh/product" /> <link rel="alternate" hreflang="zh-hant" href="https://example.com/zh-tw/product" /> <link rel="alternate" hreflang="x-default" href="https://example.com/product" />
Link: <https://example.com/product>; rel="alternate"; hreflang="en",
<https://example.com/ja/product>; rel="alternate"; hreflang="ja",
<https://example.com/ko/product>; rel="alternate"; hreflang="ko",
<https://example.com/zh/product>; rel="alternate"; hreflang="zh-hans",
<https://example.com/zh-tw/product>; rel="alternate"; hreflang="zh-hant",
<https://example.com/product>; rel="alternate"; hreflang="x-default"
<?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/product</loc>
<xhtml:link rel="alternate" hreflang="en"
href="https://example.com/product" />
<xhtml:link rel="alternate" hreflang="ja"
href="https://example.com/ja/product" />
<xhtml:link rel="alternate" hreflang="ko"
href="https://example.com/ko/product" />
<xhtml:link rel="alternate" hreflang="zh-hans"
href="https://example.com/zh/product" />
<xhtml:link rel="alternate" hreflang="zh-hant"
href="https://example.com/zh-tw/product" />
<xhtml:link rel="alternate" hreflang="x-default"
href="https://example.com/product" />
</url>
<url>
<loc>https://example.com/ja/product</loc>
<xhtml:link rel="alternate" hreflang="en"
href="https://example.com/product" />
<xhtml:link rel="alternate" hreflang="ja"
href="https://example.com/ja/product" />
<xhtml:link rel="alternate" hreflang="ko"
href="https://example.com/ko/product" />
<xhtml:link rel="alternate" hreflang="zh-hans"
href="https://example.com/zh/product" />
<xhtml:link rel="alternate" hreflang="zh-hant"
href="https://example.com/zh-tw/product" />
<xhtml:link rel="alternate" hreflang="x-default"
href="https://example.com/product" />
</url>
<url>
<loc>https://example.com/ko/product</loc>
<xhtml:link rel="alternate" hreflang="en"
href="https://example.com/product" />
<xhtml:link rel="alternate" hreflang="ja"
href="https://example.com/ja/product" />
<xhtml:link rel="alternate" hreflang="ko"
href="https://example.com/ko/product" />
<xhtml:link rel="alternate" hreflang="zh-hans"
href="https://example.com/zh/product" />
<xhtml:link rel="alternate" hreflang="zh-hant"
href="https://example.com/zh-tw/product" />
<xhtml:link rel="alternate" hreflang="x-default"
href="https://example.com/product" />
</url>
<url>
<loc>https://example.com/zh/product</loc>
<xhtml:link rel="alternate" hreflang="en"
href="https://example.com/product" />
<xhtml:link rel="alternate" hreflang="ja"
href="https://example.com/ja/product" />
<xhtml:link rel="alternate" hreflang="ko"
href="https://example.com/ko/product" />
<xhtml:link rel="alternate" hreflang="zh-hans"
href="https://example.com/zh/product" />
<xhtml:link rel="alternate" hreflang="zh-hant"
href="https://example.com/zh-tw/product" />
<xhtml:link rel="alternate" hreflang="x-default"
href="https://example.com/product" />
</url>
<url>
<loc>https://example.com/zh-tw/product</loc>
<xhtml:link rel="alternate" hreflang="en"
href="https://example.com/product" />
<xhtml:link rel="alternate" hreflang="ja"
href="https://example.com/ja/product" />
<xhtml:link rel="alternate" hreflang="ko"
href="https://example.com/ko/product" />
<xhtml:link rel="alternate" hreflang="zh-hans"
href="https://example.com/zh/product" />
<xhtml:link rel="alternate" hreflang="zh-hant"
href="https://example.com/zh-tw/product" />
<xhtml:link rel="alternate" hreflang="x-default"
href="https://example.com/product" />
</url>
</urlset>
偵測到廣告封鎖,導致我們無法顯示廣告
MiniWebtool 依靠廣告收入免費提供服務。如果這個工具幫到你,歡迎升級 Premium(無廣告 + 更快),或將 MiniWebtool.com 加入允許清單後重新整理頁面。
- 或升級 Premium(無廣告)
- 允許 MiniWebtool.com 顯示廣告,然後重新載入
Hreflang 標籤產生器
hreflang標籤產生器可為多語言和多地區網站創建格式正確的 hreflang 註釋。它支持三種實施方法:HTML 連結標籤、HTTP 回應標頭和 XML 網站地圖。此計算機還包含智能 URL 自動填入、匯入現有標記、語言預設組合以及內置驗證功能,幫助您避免可能損害國際 SEO 的常見 hreflang 錯誤。
如何使用此工具
- 新增語言版本 — 對於網頁的每個語言版本,輸入 hreflang 語言-地區代碼(例如
en,es,fr-ca)和完整 URL。使用自動完成建議或輸入您自己的代碼。 - 使用自動填入(選填) — 輸入基礎 URL 並選擇「子目錄」或「子網域」模式,以自動為每個語言條目生成 URL。
- 新增 x-default — 包含一個
x-default條目,指向您的備用頁面(通常是您的主要語言版本或語言選擇頁面)。 - 生成標籤 — 點擊「生成標籤」按鈕以產生三種格式的輸出。請查看任何驗證警告。
- 複製並實施 — 使用分頁輸出複製所需的格式。對於 HTML,將標籤貼到每個語言版本的
<head>中。對於 XML 網站地圖,下載文件並將其上傳到您的服務器。
使用者
引擎
hreflang
西班牙語頁面
了解 Hreflang 屬性
Hreflang 是 Google 於 2011 年推出的一種 HTML 屬性,旨在幫助網站管理員指示網頁的語言和地理定位。當一個網站擁有由多種語言或地區差異構成的內容時(例如,針對美國的英文與針對英國的英文),hreflang 標籤會告訴搜尋引擎應根據使用者的語言和位置在搜尋結果中顯示哪個版本。
hreflang 的值遵循 language-region 格式,其中:
- 語言代碼 — ISO 639-1 兩字母代碼(例如,
en代表英文,es代表西班牙文,ja代表日文) - 地區代碼(選填) — ISO 3166-1 Alpha 2 國家代碼(例如,
us代表美國,gb代表英國,mx代表墨西哥)
特殊代碼如 zh-hans(簡體中文)和 zh-hant(繁體中文)使用腳本子標籤而非地區代碼。
實施方法比較
HTML 連結標籤 最常見
在每個頁面的 <head> 部分放置 <link> 元素。實施簡單,適用於大多數網站。
hreflang="en"
href="https://example.com/" />
最適用於: 語言版本數量適中的標準 HTML 網站。
HTTP 標頭 適用於非 HTML
在 HTTP 回應標頭中發送 hreflang 信息。對於沒有 HTML <head> 的文件(如 PDF)非常有用。
rel="alternate";
hreflang="en"
最適用於: PDF 文件、非 HTML 文檔以及您可以配置服務器標頭的網站。
XML 網站地圖 適用於大型網站
使用 xhtml:link 元素將 hreflang 註釋添加到您的 XML 網站地圖中。對於擁有大量頁面和語言版本的網站是理想之選。
hreflang="en"
href="https://example.com/" />
最適用於: 擁有數百或數千個多語言頁面的大型網站。
應避免的常見 Hreflang 錯誤
- 缺少互惠標籤: hreflang 標籤中引用的每個頁面都必須連結回所有其他語言版本。如果頁面 A 引用頁面 B,則頁面 B 也必須引用頁面 A。非互惠標籤會被搜尋引擎忽略。
- 缺少自我引用標籤: 每個頁面都應包含一個指向自身的 hreflang 標籤。這向搜尋引擎確認該頁面是有意作為 hreflang 集合的一部分。
- 忘記 x-default: 務必包含
x-default標籤,以處理語言/地區不匹配任何指定 hreflang 標籤的使用者。如果沒有它,搜尋引擎就沒有備用指令。 - 使用錯誤的語言代碼: 使用 ISO 639-1 語言代碼和 ISO 3166-1 Alpha 2 地區代碼。常見錯誤包括使用
uk代表英國英文而非en-gb,或使用jp而非ja代表日文。 - 混合通訊協定或網域: 所有 hreflang URL 應使用相同的通訊協定(建議使用 HTTPS)並與標準 (canonical) URL 完全一致。hreflang URL 與標準標籤之間的不一致會引起搜尋引擎的混亂。
最佳實踐
- 在 hreflang 標籤中始終使用絕對 URL(包含
https://),絕不使用相對路徑。 - 在每個頁面上包含自我引用的 hreflang 標籤。
- 添加指向主要版本或語言選擇頁面的
x-default標籤。 - 確保 hreflang URL 與每個頁面的標準 URL 完全一致。
- 每個頁面僅使用一種實施方法(不要在同一個頁面上混合使用 HTML 標籤和網站地圖註釋)。
- 定期使用此計算機、Google Search Console 或其他 SEO 審核工具驗證 hreflang 標籤。
- 對於針對不同地區相同語言的頁面(例如
en-us和en-gb),務必同時包含語言和地區代碼。
常見問題
什麼是 hreflang 標籤?
Hreflang 標籤是 HTML 屬性,告訴搜尋引擎應該向用戶顯示哪個語言和地區版本的頁面。它們使用 rel="alternate" hreflang="x" 屬性來指示語言替代方案,幫助搜尋引擎根據用戶的語言和位置提供正確的版本。
我應該在哪裡放置 hreflang 標籤?
Hreflang 標籤可以放在三個位置:HTML 的 <head> 區塊作為 <link> 元素、HTTP 回應標頭,或者 XML 網站地圖中。HTML head 方法對於標準網站最常見,HTTP 標頭適用於 PDF 等非 HTML 文件,而 XML 網站地圖則非常適合擁有大量語言版本的大型網站。
hreflang 中的 x-default 是什麼?
x-default 值是一個特殊的 hreflang 屬性,指定當用戶的語言或地區與任何指定的 hreflang 標籤都不匹配時的預設或備用頁面。Google 建議始終包含一個指向主要語言版本或語言選擇頁面的 x-default 標籤。
hreflang 標籤需要互惠嗎?
是的,hreflang 標籤必須是互惠的(也稱為雙向)。如果頁面 A 使用 hreflang 標籤連結到頁面 B,則頁面 B 也必須使用相應的 hreflang 標籤連結回頁面 A。如果缺少互惠連結,搜尋引擎可能會完全忽略該 hreflang 註釋。
hreflang 中的語言和地區有什麼區別?
在 hreflang 標籤中,語言代碼(例如 en, es, fr)使用 ISO 639-1 格式並指定內容語言。可選的地區代碼(例如 us, gb, mx)使用 ISO 3166-1 Alpha 2 格式並針對特定國家。例如,en-us 針對美國的英語使用者,而 en-gb 則針對英國的英語使用者。
引用此內容、頁面或工具為:
"Hreflang 標籤產生器" 於 https://MiniWebtool.com/zh-tw//,來自 MiniWebtool,https://MiniWebtool.com/
由 miniwebtool 團隊製作。更新日期:2026-03-10