Add Hreflang label for Multi-Language WebSite
For multi-language website, the most hard thing is how to show correct language to correct user, we may use javascript to detect user's browser language for display, but today we have a new tool: hreflang, it's working on search engines level which can direct split user from search engines. Follow will use yiilib.com as a demo to show how to use hreflang label.
{Page 1. Index Page http://yiilib.com}
<!-- Chinese User -->
<link rel="alternate" href="http://yiilib.com/" hreflang="zh">
<!-- English User -->
<link rel="alternate" href="http://yiilib.com/en" hreflang="en">
<!-- Other not Match User -->
<link rel="alternate" href="http://yiilib.com/" hreflang="x-default">
{Information}
1. each page have 3 labels, zh, en, x-default. the default one is x-default, which means display for no language match,
2. must have return link, like in Yiilib.com header section should have hreflang lable with yiilib.com/en, and in yiilib.com/en header section need have hreflang label for yiilib.com
3. always try add hreflang for all pages, it's an easy job for php
{More Example}
{Page 2. Portfolio http://yiilib.com/project}
<link rel="alternate" href="http://yiilib.com/project" hreflang="zh">
<link rel="alternate" href="http://yiilib.com/en/project" hreflang="en">
<link rel="alternate" href="http://yiilib.com/project" hreflang="x-default">
{Page 3. Topic lib http://yiilib.com/topic}
<link rel="alternate" href="http://yiilib.com/topic" hreflang="zh">
<link rel="alternate" href="http://yiilib.com/en/topic" hreflang="en">
<link rel="alternate" href="http://yiilib.com/topic" hreflang="x-default">
{Page 4. Topic <<USE PHP AND NGINX TO CONTROL CDN REFRESH TIME>> http://yiilib.com/en/topic/665/Use+PHP+and+Nginx+to+control+CDN+refresh+time}
<link rel="alternate" href="http://yiilib.com/topic/665/使用PHP和Nginx控制CDN刷新时间" hreflang="zh">
<link rel="alternate" href="http://yiilib.com/en/topic/665/Use+PHP+and+Nginx+to+control+CDN+refresh+time" hreflang="en">
<link rel="alternate" href="http://yiilib.com/topic/665/使用PHP和Nginx控制CDN刷新时间" hreflang="x-default">
Leave Comment