Proper handling of canonical URLs (#52)
* add canonical_url block to base.html, change canonical url for pages * Avoid nesting block within block That leads to repeating the block twice instead of replacing its value from `base.html`
This commit is contained in:
parent
c7698d2b31
commit
73e216f522
3 changed files with 6 additions and 2 deletions
|
@ -27,10 +27,10 @@
|
||||||
{% set selected_color = HEADER_COLOR %}
|
{% set selected_color = HEADER_COLOR %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% block canonical_url %}<link href="{{ SITEURL }}/{{ article.url }}" rel="canonical" />{% endblock canonical_url %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
|
|
||||||
<link href="{{ SITEURL }}/{{ article.url }}" rel="canonical" />
|
|
||||||
{% for keyword in article.keywords %}
|
{% for keyword in article.keywords %}
|
||||||
<meta name="keywords" content="{{keyword}}" >
|
<meta name="keywords" content="{{keyword}}" >
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="referrer" content="origin" />
|
<meta name="referrer" content="origin" />
|
||||||
<meta name="generator" content="Pelican" />
|
<meta name="generator" content="Pelican" />
|
||||||
<link href="{{ SITEURL }}/" rel="canonical" />
|
{% block canonical_url %}<link href="{{ SITEURL }}/" rel="canonical" />{% endblock canonical_url %}
|
||||||
|
|
||||||
<!-- Feed -->
|
<!-- Feed -->
|
||||||
{% for name,link in SOCIAL if name.lower() in ['rss', 'rss-square', 'feed'] %}
|
{% for name,link in SOCIAL if name.lower() in ['rss', 'rss-square', 'feed'] %}
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
{% block title %}{{ page.title }}{% endblock title %}
|
{% block title %}{{ page.title }}{% endblock title %}
|
||||||
|
|
||||||
|
{% block canonical_url %}
|
||||||
|
<link href="{{ SITEURL }}/{{ page.url }}" rel="canonical" />
|
||||||
|
{% endblock canonical_url %}
|
||||||
|
|
||||||
{# <!-- Choosing cover image --> #}
|
{# <!-- Choosing cover image --> #}
|
||||||
{% if page.cover %}
|
{% if page.cover %}
|
||||||
{% if page.cover|lower|truncate(4, True, '') == "http" %}
|
{% if page.cover|lower|truncate(4, True, '') == "http" %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue