Skip to content

Commit

Permalink
Renaming feed_helper.tmpl -> translation_link_helper.tmpl and moving …
Browse files Browse the repository at this point in the history
…code for alternate links into there.
  • Loading branch information
felixfontein committed Jun 8, 2017
1 parent 16804f0 commit f2ad9b3
Show file tree
Hide file tree
Showing 24 changed files with 72 additions and 90 deletions.
4 changes: 2 additions & 2 deletions nikola/data/themes/base-jinja/templates/archiveindex.tmpl
@@ -1,11 +1,11 @@
{# -*- coding: utf-8 -*- #}
{% extends 'index.tmpl' %}
{% import 'archive_navigation_helper.tmpl' as archive_nav with context %}
{% import 'feed_helper.tmpl' as feed with context %}
{% import 'translation_link_helper.tmpl' as translation_links with context %}

{% block extra_head %}
{{ super() }}
{{ feed.head(archive_name) }}
{{ translation_links.head(archive_name) }}
{% endblock %}

{% block content_header %}
Expand Down
6 changes: 3 additions & 3 deletions nikola/data/themes/base-jinja/templates/author.tmpl
@@ -1,10 +1,10 @@
{# -*- coding: utf-8 -*- #}
{% extends 'list_post.tmpl' %}
{% import 'feed_helper.tmpl' as feed with context %}
{% import 'translation_link_helper.tmpl' as translation_links with context %}

{% block extra_head %}
{{ super() }}
{{ feed.head(author) }}
{{ translation_links.head(author) }}
{% endblock %}


Expand All @@ -16,7 +16,7 @@
<p>{{ description }}</p>
{% endif %}
<div class="metadata">
{{ feed.link(author) }}
{{ translation_links.link(author) }}
</div>
</header>
{% if posts %}
Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/base-jinja/templates/authorindex.tmpl
@@ -1,8 +1,8 @@
{# -*- coding: utf-8 -*- #}
{% extends 'index.tmpl' %}
{% import 'feed_helper.tmpl' as feed with context %}
{% import 'translation_link_helper.tmpl' as translation_links with context %}

{% block extra_head %}
{{ super() }}
{{ feed.head(author) }}
{{ translation_links.head(author) }}
{% endblock %}
6 changes: 3 additions & 3 deletions nikola/data/themes/base-jinja/templates/base_helper.tmpl
@@ -1,5 +1,5 @@
{# -*- coding: utf-8 -*- #}
{% import 'feed_helper.tmpl' as feed with context %}
{% import 'translation_link_helper.tmpl' as translation_links with context %}

{% macro html_headstart() %}
<!DOCTYPE html>
Expand Down Expand Up @@ -42,7 +42,7 @@ lang="{{ lang }}">
{% if meta_generator_tag %}
<meta name="generator" content="Nikola (getnikola.com)">
{% endif %}
{{ feed.head() }}
{{ translation_links.head() }}
<link rel="canonical" href="{{ abs_link(permalink) }}">

{% if favicons %}
Expand Down Expand Up @@ -100,7 +100,7 @@ lang="{{ lang }}">

{# This function is deprecated; use feed_helper directly. #}
{% macro html_feedlinks() %}
{{ feed.head() }}
{{ translation_links.head() }}
{% endmacro %}

{% macro html_translations() %}
Expand Down
11 changes: 5 additions & 6 deletions nikola/data/themes/base-jinja/templates/index.tmpl
Expand Up @@ -11,11 +11,6 @@
<link rel="prefetch" href="{{ posts[0].permalink() }}" type="text/html">
{% endif %}
{{ math.math_styles_ifposts(posts) }}
{% if has_other_languages and other_languages %}
{% for language, classification, _ in other_languages %}
<link rel="alternate" hreflang="{{ language }}" href="{{ _link(kind, classification, language) }}">
{% endfor %}
{% endif %}
{% endblock %}

{% block content %}
Expand All @@ -24,7 +19,11 @@
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, classification, name in other_languages %}
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }} ({{ name|e }})</a></p>
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }}
{% if kind != 'archive' %}
({{ name|e }})
{% endif %}
</a></p>
{% endfor %}
</div>
{% endif %}
Expand Down
14 changes: 5 additions & 9 deletions nikola/data/themes/base-jinja/templates/list.tmpl
Expand Up @@ -2,14 +2,6 @@
{% extends 'base.tmpl' %}
{% import 'archive_navigation_helper.tmpl' as archive_nav with context %}

{% block extra_head %}
{% if has_other_languages and other_languages %}
{% for language, classification, _ in other_languages %}
<link rel="alternate" hreflang="{{ language }}" href="{{ _link(kind, classification, language) }}">
{% endfor %}
{% endif %}
{% endblock %}

{% block content %}
<article class="listpage">
<header>
Expand All @@ -20,7 +12,11 @@
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, classification, name in other_languages %}
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }} ({{ name|e }})</a></p>
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }}
{% if kind != 'archive' %}
({{ name|e }})
{% endif %}
</a></p>
{% endfor %}
</div>
{% endif %}
Expand Down
14 changes: 5 additions & 9 deletions nikola/data/themes/base-jinja/templates/list_post.tmpl
Expand Up @@ -2,14 +2,6 @@
{% extends 'base.tmpl' %}
{% import 'archive_navigation_helper.tmpl' as archive_nav with context %}

{% block extra_head %}
{% if has_other_languages and other_languages %}
{% for language, classification, _ in other_languages %}
<link rel="alternate" hreflang="{{ language }}" href="{{ _link(kind, classification, language) }}">
{% endfor %}
{% endif %}
{% endblock %}

{% block content %}
<article class="listpage">
<header>
Expand All @@ -20,7 +12,11 @@
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, classification, name in other_languages %}
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }} ({{ name|e }})</a></p>
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }}
{% if kind != 'archive' %}
({{ name|e }})
{% endif %}
</a></p>
{% endfor %}
</div>
{% endif %}
Expand Down
6 changes: 3 additions & 3 deletions nikola/data/themes/base-jinja/templates/sectionindex.tmpl
@@ -1,17 +1,17 @@
{# -*- coding: utf-8 -*- #}
{% extends 'index.tmpl' %}
{% import 'feed_helper.tmpl' as feed with context %}
{% import 'translation_link_helper.tmpl' as translation_links with context %}

{% block extra_head %}
{{ super() }}
{{ feed.head(section) }}
{{ translation_links.head(section) }}
{% endblock %}

{% block content %}
<div class="sectionindex">
<header>
<h2><a href="{{ _link('section_index', section) }}">{{ title|e }}</a></h2>
{{ feed.link(section) }}
{{ translation_links.link(section) }}
</header>
{{ super() }}
</div>
Expand Down
12 changes: 8 additions & 4 deletions nikola/data/themes/base-jinja/templates/tag.tmpl
@@ -1,10 +1,10 @@
{# -*- coding: utf-8 -*- #}
{% extends 'list_post.tmpl' %}
{% import 'feed_helper.tmpl' as feed with context %}
{% import 'translation_link_helper.tmpl' as translation_links with context %}

{% block extra_head %}
{{ super() }}
{{ feed.head(tag) }}
{{ translation_links.head(tag) }}
{% endblock %}


Expand All @@ -24,13 +24,17 @@
</ul>
{% endif %}
<div class="metadata">
{{ feed.link(tag) }}
{{ translation_links.link(tag) }}
</div>
{% if has_other_languages and other_languages %}
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, classification, name in other_languages %}
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }} ({{ name|e }})</a></p>
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }}
{% if kind != 'archive' %}
({{ name|e }})
{% endif %}
</a></p>
{% endfor %}
</div>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/base-jinja/templates/tagindex.tmpl
@@ -1,6 +1,6 @@
{# -*- coding: utf-8 -*- #}
{% extends 'index.tmpl' %}
{% import 'feed_helper.tmpl' as feed with context %}
{% import 'translation_link_helper.tmpl' as translation_links with context %}

{% block content_header %}
{{ parent.content_header() }}
Expand All @@ -22,5 +22,5 @@

{% block extra_head %}
{{ super() }}
{{ feed.head(tag) }}
{{ translation_links.head(tag) }}
{% endblock %}
Expand Up @@ -38,6 +38,11 @@
{% endif %}
{% endif %}
{% endif %}
{% if has_other_languages and other_languages %}
{% for language, classification, _ in other_languages %}
<link rel="alternate" hreflang="{{ language }}" href="{{ _link(kind, classification, language) }}">
{% endfor %}
{% endif %}
{% endmacro %}

{% macro link(classification) %}
Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/base/templates/archiveindex.tmpl
@@ -1,11 +1,11 @@
## -*- coding: utf-8 -*-
<%inherit file="index.tmpl"/>
<%namespace name="archive_nav" file="archive_navigation_helper.tmpl" import="*"/>
<%namespace name="feed" file="feed_helper.tmpl" import="*"/>
<%namespace name="translation_links" file="translation_link_helper.tmpl" import="*"/>

<%block name="extra_head">
${parent.extra_head()}
${feed.head(archive_name)}
${translation_links.head(archive_name)}
</%block>

<%block name="content_header">
Expand Down
6 changes: 3 additions & 3 deletions nikola/data/themes/base/templates/author.tmpl
@@ -1,10 +1,10 @@
## -*- coding: utf-8 -*-
<%inherit file="list_post.tmpl"/>
<%namespace name="feed" file="feed_helper.tmpl" import="*"/>
<%namespace name="translation_links" file="translation_link_helper.tmpl" import="*"/>

<%block name="extra_head">
${parent.extra_head()}
${feed.head(author)}
${translation_links.head(author)}
</%block>


Expand All @@ -16,7 +16,7 @@
<p>${description}</p>
%endif
<div class="metadata">
${feed.link(author)}
${translation_links.link(author)}
</div>
</header>
%if posts:
Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/base/templates/authorindex.tmpl
@@ -1,8 +1,8 @@
## -*- coding: utf-8 -*-
<%inherit file="index.tmpl"/>
<%namespace name="feed" file="feed_helper.tmpl" import="*"/>
<%namespace name="translation_links" file="translation_link_helper.tmpl" import="*"/>

<%block name="extra_head">
${parent.extra_head()}
${feed.head(author)}
${translation_links.head(author)}
</%block>
6 changes: 3 additions & 3 deletions nikola/data/themes/base/templates/base_helper.tmpl
@@ -1,5 +1,5 @@
## -*- coding: utf-8 -*-
<%namespace name="feed" file="feed_helper.tmpl" import="*"/>
<%namespace name="translation_links" file="translation_link_helper.tmpl" import="*"/>

<%def name="html_headstart()">
<!DOCTYPE html>
Expand Down Expand Up @@ -42,7 +42,7 @@ lang="${lang}">
% if meta_generator_tag:
<meta name="generator" content="Nikola (getnikola.com)">
% endif
${feed.head()}
${translation_links.head()}
<link rel="canonical" href="${abs_link(permalink)}">

%if favicons:
Expand Down Expand Up @@ -100,7 +100,7 @@ lang="${lang}">

### This function is deprecated; use feed_helper directly.
<%def name="html_feedlinks()">
${feed.head()}
${translation_links.head()}
</%def>

<%def name="html_translations()">
Expand Down
5 changes: 0 additions & 5 deletions nikola/data/themes/base/templates/index.tmpl
Expand Up @@ -11,11 +11,6 @@
<link rel="prefetch" href="${posts[0].permalink()}" type="text/html">
% endif
${math.math_styles_ifposts(posts)}
%if has_other_languages and other_languages:
%for language, classification, _ in other_languages:
<link rel="alternate" hreflang="${language}" href="${_link(kind, classification, language)}">
%endfor
%endif
</%block>

<%block name="content">
Expand Down
8 changes: 0 additions & 8 deletions nikola/data/themes/base/templates/list.tmpl
Expand Up @@ -2,14 +2,6 @@
<%inherit file="base.tmpl"/>
<%namespace name="archive_nav" file="archive_navigation_helper.tmpl" import="*"/>

<%block name="extra_head">
%if has_other_languages and other_languages:
%for language, classification, _ in other_languages:
<link rel="alternate" hreflang="${language}" href="${_link(kind, classification, language)}">
%endfor
%endif
</%block>

<%block name="content">
<article class="listpage">
<header>
Expand Down
8 changes: 0 additions & 8 deletions nikola/data/themes/base/templates/list_post.tmpl
Expand Up @@ -2,14 +2,6 @@
<%inherit file="base.tmpl"/>
<%namespace name="archive_nav" file="archive_navigation_helper.tmpl" import="*"/>

<%block name="extra_head">
%if has_other_languages and other_languages:
%for language, classification, _ in other_languages:
<link rel="alternate" hreflang="${language}" href="${_link(kind, classification, language)}">
%endfor
%endif
</%block>

<%block name="content">
<article class="listpage">
<header>
Expand Down
6 changes: 3 additions & 3 deletions nikola/data/themes/base/templates/sectionindex.tmpl
@@ -1,17 +1,17 @@
## -*- coding: utf-8 -*-
<%inherit file="index.tmpl"/>
<%namespace name="feed" file="feed_helper.tmpl" import="*"/>
<%namespace name="translation_links" file="translation_link_helper.tmpl" import="*"/>

<%block name="extra_head">
${parent.extra_head()}
${feed.head(section)}
${translation_links.head(section)}
</%block>

<%block name="content">
<div class="sectionindex">
<header>
<h2><a href="${_link('section_index', section)}">${title|h}</a></h2>
${feed.link(section)}
${translation_links.link(section)}
</header>
${parent.content()}
</div>
Expand Down
6 changes: 3 additions & 3 deletions nikola/data/themes/base/templates/tag.tmpl
@@ -1,10 +1,10 @@
## -*- coding: utf-8 -*-
<%inherit file="list_post.tmpl"/>
<%namespace name="feed" file="feed_helper.tmpl" import="*"/>
<%namespace name="translation_links" file="translation_link_helper.tmpl" import="*"/>

<%block name="extra_head">
${parent.extra_head()}
${feed.head(tag)}
${translation_links.head(tag)}
</%block>


Expand All @@ -24,7 +24,7 @@
</ul>
%endif
<div class="metadata">
${feed.link(tag)}
${translation_links.link(tag)}
</div>
%if has_other_languages and other_languages:
<div class="translationslist translations">
Expand Down

0 comments on commit f2ad9b3

Please sign in to comment.