All <link rel="alternate" hreflang> for i18n pages
This commit is contained in:
parent
143f2b33df
commit
847258f60c
@ -15,7 +15,13 @@
|
|||||||
<link rel="alternate" href="{{ '/feed/feed.xml' | url }}" type="application/atom+xml" title="{{ metadata.title }}">
|
<link rel="alternate" href="{{ '/feed/feed.xml' | url }}" type="application/atom+xml" title="{{ metadata.title }}">
|
||||||
<link rel="alternate" href="{{ '/feed/feed.json' | url }}" type="application/json" title="{{ metadata.title }}">
|
<link rel="alternate" href="{{ '/feed/feed.json' | url }}" type="application/json" title="{{ metadata.title }}">
|
||||||
|
|
||||||
{# TODO add link rel="alternate" for langs #}
|
{%- set alternateUrls = page.url | locale_links %}
|
||||||
|
{% if alternateUrls.length %}
|
||||||
|
<link rel="alternate" hreflang="{{ lang or metadata.language }}" href="{{ page.url | absoluteUrl(metadata.url) }}">
|
||||||
|
{%- for link in alternateUrls %}
|
||||||
|
<link rel="alternate" hreflang="{{ link.lang }}" href="{{ link.url | absoluteUrl(metadata.url) }}">
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -18,10 +18,11 @@ templateClass: tmpl-post
|
|||||||
{% if i18nLinks.length %}
|
{% if i18nLinks.length %}
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
This page is also available in: <!-- don’t forget to localize this text too -->
|
This page is also available in:
|
||||||
{%- for link in i18nLinks %}
|
{%- for link in i18nLinks %}
|
||||||
{%- if not loop.first %},{% endif %}<a href="{{link.url}}" lang="{{link.lang}}" hreflang="{{link.lang}}">{{link.label}}</a>
|
<a href="{{ link.url }}" lang="{{ link.lang }}" hreflang="{{ link.lang }}">{{ link.label }}</a>
|
||||||
{%- endfor -%}
|
{%- if not loop.last %},{% endif %}
|
||||||
|
{%- endfor -%}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user