forked from github/pelican
Add hreflang attribute to default themes
This commit is contained in:
parent
b30270190a
commit
d1d1cccdad
39 changed files with 104 additions and 37 deletions
|
|
@ -5,6 +5,12 @@
|
|||
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
|
||||
{% import 'translations.html' as translations with context %}
|
||||
{% if translations.entry_hreflang(article) %}
|
||||
{{ translations.entry_hreflang(article) }}
|
||||
{% endif %}
|
||||
|
||||
{% if article.description %}
|
||||
<meta name="description" content="{{article.description}}" />
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,15 @@
|
|||
|
||||
{% block title %}{{ SITENAME }} - {{ page.title }}{%endblock%}
|
||||
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
|
||||
{% import 'translations.html' as translations with context %}
|
||||
{% if translations.entry_hreflang(page) %}
|
||||
{{ translations.entry_hreflang(page) }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ page.title }}</h1>
|
||||
{% import 'translations.html' as translations with context %}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,16 @@
|
|||
{% macro translations_for(article) %}
|
||||
{% if article.translations %}
|
||||
Translations:
|
||||
Translations:
|
||||
{% for translation in article.translations %}
|
||||
<a href="{{ SITEURL }}/{{ translation.url }}">{{ translation.lang }}</a>
|
||||
<a href="{{ SITEURL }}/{{ translation.url }}" hreflang="{{ translation.lang }}">{{ translation.lang }}</a>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro entry_hreflang(entry) %}
|
||||
{% if entry.translations %}
|
||||
{% for translation in entry.translations %}
|
||||
<link rel="alternate" hreflang="{{ translation.lang }}" href="{{ SITEURL }}/{{ translation.url }}">
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue