Here we are simple way to add 'hreflang' manually. We just have to add code in "html.html.twig" file.
For Front page code:
{% if is_front %}
<link rel="alternate" href="https://www.google.com/" hreflang="x-default" />
<link rel="alternate" href="https://de.google.com/" hreflang="de-de" />
<link rel="alternate" href="https://www.google.com.cn/" hreflang="zh-cn" />
<link rel="alternate" href="https://fr.google.com/" hreflang="fr-fr" />
{% endif %}
For Full website code: Without add any "if" condition.
<link rel="alternate" href="https://www.google.com/" hreflang="x-default" />
<link rel="alternate" href="https://de.google.com/" hreflang="de-de" />
<link rel="alternate" href="https://www.google.com.cn/" hreflang="zh-cn" />
<link rel="alternate" href="https://fr.google.com/" hreflang="fr-fr" />
<meta name="title" content="News Releases" />
<meta name="description" content="demo description." />
<meta name="keywords" content="demo, description" />
Note: If have any suggestions or issue regarding 'How to set hreflang manually in website?' then you can ask by comments.
For Front page code:
{% if is_front %}
<link rel="alternate" href="https://www.google.com/" hreflang="x-default" />
<link rel="alternate" href="https://de.google.com/" hreflang="de-de" />
<link rel="alternate" href="https://www.google.com.cn/" hreflang="zh-cn" />
<link rel="alternate" href="https://fr.google.com/" hreflang="fr-fr" />
{% endif %}
For Full website code: Without add any "if" condition.
<link rel="alternate" href="https://www.google.com/" hreflang="x-default" />
<link rel="alternate" href="https://de.google.com/" hreflang="de-de" />
<link rel="alternate" href="https://www.google.com.cn/" hreflang="zh-cn" />
<link rel="alternate" href="https://fr.google.com/" hreflang="fr-fr" />
<meta name="title" content="News Releases" />
<meta name="description" content="demo description." />
<meta name="keywords" content="demo, description" />
Note: If have any suggestions or issue regarding 'How to set hreflang manually in website?' then you can ask by comments.
No comments:
Post a Comment