大网数据广告活动
网站运营与故障问答

What is the difference between HTML lang attribute and LINK hreflink attribute?

· 52CE 我爱测

Let say example.com has two different country version apart from main English version Israel(example.il) New Zealand(example.nz) What SEO practice should I follow. Method 1 - HTML lang example.com <html lang="en"> example.il <htm…

问题原文

原帖链接 · rram · CC BY-SA 4.0

Let say example.com has two different country version apart from main English version

  1. Israel(example.il)
  2. New Zealand(example.nz)

What SEO practice should I follow.

Method 1 - HTML lang

example.com
<html lang="en">
example.il
<html lang="he-IL">
example.nz
<html lang="en-NZ">

Method 2 - HTML hreflang link inside head tag example.com

<head>
<link rel="alternate" href="http://example.com/" 
      hreflang="en" />
<link rel="alternate" href="http://example.il/" 
      hreflang="he-IL" />
<link rel="alternate" href="http://example.nz/" 
      hreflang="en-NZ" />
</head>

similarly use the same for other pages(example.il,example.nz).

Google says from 2011 they started treating link with hreflang for mentioning language specific content. Now Which method should I use to make the site language and country specific when it comes to search engines?

What is the difference between <html lang> and <link hreflang> ?

社区高分解答

原帖链接 · DocRoot · CC BY-SA 4.0

Which method should I use ...

What is the difference between <html lang> and <link hreflang>.

You can use both.

The lang attribute on the html tag informs user-agents the language of the current document.

The hreflang attribute informs user-agents/bots of the location of alternative localised versions of the current document.

In a way they are complementary.

However, Google most probably ignores the lang attribute and auto-detects the document language instead. I believe Google ignores all language identifiers, except for hreflang.

hreflang on the other hand is recommended by Google to help indexing of multi-lingual websites. So, if you needed to choose one or the other then the hreflang would be the one to go for.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2017-05-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。