Set alternate link tags for translated content
`<link rel="alternate">` is good practice for SEO and helps people find the content in their preferred language.
This commit is contained in:
parent
6caa5009f9
commit
d13b9ae0a8
2 changed files with 18 additions and 0 deletions
|
@ -5,6 +5,13 @@
|
|||
<meta name="description" content="{{ article.summary|striptags|escape }}" />
|
||||
<meta name="keywords" content="{{ article.tags|join(', ')|escape }}">
|
||||
|
||||
{% if article.translations -%}
|
||||
<link rel="alternate" href="{{ SITEURL }}/{{ article.url }}" hreflang="{{ article.lang }}" />
|
||||
{% for a in article.translations %}
|
||||
<link rel="alternate" href="{{ SITEURL }}/{{ a.url }}" hreflang="{{ a.lang }}" />
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% include "partial/og_article.html" %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block meta %}
|
||||
{{ super() }}
|
||||
|
||||
{% if page.translations -%}
|
||||
<link rel="alternate" href="{{ SITEURL }}/{{ page.url }}" hreflang="{{ page.lang }}" />
|
||||
{% for p in page.translations %}
|
||||
<link rel="alternate" href="{{ SITEURL }}/{{ p.url }}" hreflang="{{ p.lang }}" />
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block title %} – {{ page.title }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
|
Loading…
Reference in a new issue