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.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>
|
||||
<body>
|
||||
<header>
|
||||
|
@ -18,9 +18,10 @@ templateClass: tmpl-post
|
||||
{% if i18nLinks.length %}
|
||||
<ul>
|
||||
<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 %}
|
||||
{%- 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>
|
||||
{%- if not loop.last %},{% endif %}
|
||||
{%- endfor -%}
|
||||
</li>
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user