Permalink
Browse files

Restoring feed part of translation_link_helper.tmpl.

  • Loading branch information...
felixfontein committed Jun 8, 2017
1 parent a6856f1 commit 364ed55d41865687a95d867490560750e1373ccb
@@ -3,96 +3,72 @@
{% if rss_link %}
{{ rss_link }}
{% endif %}
- {% if has_other_languages %}
- {% for language, classification, _ in all_languages %}
- {% if generate_atom %}
- <link rel="alternate" type="application/atom+xml" title="Atom for {{ kind }} {{ classification|e }} ({{ language }})" href="{{ _link(kind + "_atom", classification, language) }}">
- {% endif %}
- {% if generate_rss and not rss_link %}
- <link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ classification|e }} ({{ language }})" href="{{ _link(kind + "_rss", classification, language) }}">
- {% endif %}
- {% endfor %}
- {% for language, classification, _ in other_languages %}
- <link rel="alternate" hreflang="{{ language }}" href="{{ _link(kind, classification, language) }}">
- {% endfor %}
- {% else %}
- {% if translations|length > 1 %}
- {% for language in translations|sort %}
- {% if classification %}
- {% if generate_atom %}
- <link rel="alternate" type="application/atom+xml" title="Atom for {{ kind }} {{ classification|e }} ({{ language }})" href="{{ _link(kind + "_atom", classification, language) }}">
- {% endif %}
- {% if generate_rss and not rss_link %}
- <link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ classification|e }} ({{ language }})" href="{{ _link(kind + "_rss", classification, language) }}">
- {% endif %}
- {% else %}
- {% if generate_atom %}
- <link rel="alternate" type="application/atom+xml" title="Atom ({{ language }})" href="{{ _link("index_atom", None, language) }}">
- {% endif %}
- {% if generate_rss and not rss_link %}
- <link rel="alternate" type="application/rss+xml" title="RSS ({{ language }})" href="{{ _link("rss", None, language) }}">
- {% endif %}
- {% endif %}
- {% endfor %}
- {% else %}
+ {% if translations|length > 1 %}
+ {% for language in translations|sort %}
{% if classification %}
{% if generate_atom %}
- <link rel="alternate" type="application/atom+xml" title="Atom for {{ kind }} {{ classification|e }}" href="{{ _link(kind + "_atom", classification) }}">
+ <link rel="alternate" type="application/atom+xml" title="Atom for {{ kind }} {{ classification|e }} ({{ language }})" href="{{ _link(kind + "_atom", classification, language) }}">
{% endif %}
{% if generate_rss and not rss_link %}
- <link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ classification|e }}" href="{{ _link(kind + "_rss", classification) }}">
+ <link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ classification|e }} ({{ language }})" href="{{ _link(kind + "_rss", classification, language) }}">
{% endif %}
{% else %}
{% if generate_atom %}
- <link rel="alternate" type="application/atom+xml" title="Atom" href="{{ _link("index_atom", None) }}">
+ <link rel="alternate" type="application/atom+xml" title="Atom ({{ language }})" href="{{ _link("index_atom", None, language) }}">
{% endif %}
{% if generate_rss and not rss_link %}
- <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ _link("rss", None) }}">
+ <link rel="alternate" type="application/rss+xml" title="RSS ({{ language }})" href="{{ _link("rss", None, language) }}">
{% endif %}
{% endif %}
+ {% endfor %}
+ {% else %}
+ {% if classification %}
+ {% if generate_atom %}
+ <link rel="alternate" type="application/atom+xml" title="Atom for {{ kind }} {{ classification|e }}" href="{{ _link(kind + "_atom", classification) }}">
+ {% endif %}
+ {% if generate_rss and not rss_link %}
+ <link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ classification|e }}" href="{{ _link(kind + "_rss", classification) }}">
+ {% endif %}
+ {% else %}
+ {% if generate_atom %}
+ <link rel="alternate" type="application/atom+xml" title="Atom" href="{{ _link("index_atom", None) }}">
+ {% endif %}
+ {% if generate_rss and not rss_link %}
+ <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ _link("rss", None) }}">
+ {% endif %}
{% endif %}
{% endif %}
+ {% if has_other_languages %}
+ {% for language, classification, _ in other_languages %}
+ <link rel="alternate" hreflang="{{ language }}" href="{{ _link(kind, classification, language) }}">
+ {% endfor %}
+ {% endif %}
{% endmacro %}
{% macro link(classification) %}
- {% if has_other_languages %}
- {% for language, classification, _ in all_languages %}
+ {% if translations|length > 1 %}
+ {% for language in translations|sort %}
{% if generate_atom or generate_rss %}
<p class="feedlink">
{% if generate_atom %}
<a href="{{ _link(kind + "_atom", classification, language) }}" hreflang="{{ language }}" type="application/atom+xml">{{ messages('Atom feed', language) }} ({{ language }})</a>
{% endif %}
{% if generate_rss %}
- <a href="{{ _link(kind + "_rss", classification, language) }}" hreflang="{{ language }}" type="application/rss+xml">{{ messages('RSS feed', language) }} ({{ language }})</a>
+ <a href="{{ _link(kind + "_rss" if classification else "rss", classification, language) }}" hreflang="{{ language }}" type="application/rss+xml">{{ messages('RSS feed', language) }} ({{ language }})</a>
{% endif %}
</p>
{% endif %}
{% endfor %}
{% else %}
- {% if translations|length > 1 %}
- {% for language in translations|sort %}
- {% if generate_atom or generate_rss %}
- <p class="feedlink">
- {% if generate_atom %}
- <a href="{{ _link(kind + "_atom", classification, language) }}" hreflang="{{ language }}" type="application/atom+xml">{{ messages('Atom feed', language) }} ({{ language }})</a>
- {% endif %}
- {% if generate_rss %}
- <a href="{{ _link(kind + "_rss", classification, language) }}" hreflang="{{ language }}" type="application/rss+xml">{{ messages('RSS feed', language) }} ({{ language }})</a>
- {% endif %}
- </p>
+ {% if generate_atom or generate_rss %}
+ <p class="feedlink">
+ {% if generate_atom %}
+ <a href="{{ _link(kind + "_atom", classification) }}" type="application/atom+xml">{{ messages('Atom feed') }}</a>
{% endif %}
- {% endfor %}
- {% else %}
- {% if generate_atom or generate_rss %}
- <p class="feedlink">
- {% if generate_atom %}
- <a href="{{ _link(kind + "_atom", classification) }}" type="application/atom+xml">{{ messages('Atom feed') }}</a>
- {% endif %}
- {% if generate_rss %}
- <a href="{{ _link(kind + "_rss", classification) }}" type="application/rss+xml">{{ messages('RSS feed') }}</a>
- {% endif %}
- </p>
- {% endif %}
+ {% if generate_rss %}
+ <a href="{{ _link(kind + "_rss" if classification else "rss", classification) }}" type="application/rss+xml">{{ messages('RSS feed') }}</a>
+ {% endif %}
+ </p>
{% endif %}
{% endif %}
{% if has_other_languages and other_languages %}
@@ -3,108 +3,84 @@
% if rss_link:
${rss_link}
% endif
- % if has_other_languages:
- %for language, classification, _ in all_languages:
- % if generate_atom:
- <link rel="alternate" type="application/atom+xml" title="Atom for ${kind} ${classification|h} (${language})" href="${_link(kind + "_atom", classification, language)}">
- % endif
- % if generate_rss and not rss_link:
- <link rel="alternate" type="application/rss+xml" title="RSS for ${kind} ${classification|h} (${language})" href="${_link(kind + "_rss", classification, language)}">
- % endif
- %endfor
- %for language, classification, _ in other_languages:
- <link rel="alternate" hreflang="${language}" href="${_link(kind, classification, language)}">
- %endfor
- % else:
- % if len(translations) > 1:
- % for language in sorted(translations):
- % if classification:
- % if generate_atom:
- <link rel="alternate" type="application/atom+xml" title="Atom for ${kind} ${classification|h} (${language})" href="${_link(kind + "_atom", classification, language)}">
- % endif
- % if generate_rss and not rss_link:
- <link rel="alternate" type="application/rss+xml" title="RSS for ${kind} ${classification|h} (${language})" href="${_link(kind + "_rss", classification, language)}">
- % endif
- % else:
- % if generate_atom:
- <link rel="alternate" type="application/atom+xml" title="Atom (${language})" href="${_link("index_atom", None, language)}">
- % endif
- % if generate_rss and not rss_link:
- <link rel="alternate" type="application/rss+xml" title="RSS (${language})" href="${_link("rss", None, language)}">
- % endif
- % endif
- % endfor
- % else:
+ % if len(translations) > 1:
+ % for language in sorted(translations):
% if classification:
% if generate_atom:
- <link rel="alternate" type="application/atom+xml" title="Atom for ${kind} ${classification|h}" href="${_link(kind + "_atom", classification)}">
+ <link rel="alternate" type="application/atom+xml" title="Atom for ${kind} ${classification|h} (${language})" href="${_link(kind + "_atom", classification, language)}">
% endif
% if generate_rss and not rss_link:
- <link rel="alternate" type="application/rss+xml" title="RSS for ${kind} ${classification|h}" href="${_link(kind + "_rss", classification)}">
+ <link rel="alternate" type="application/rss+xml" title="RSS for ${kind} ${classification|h} (${language})" href="${_link(kind + "_rss", classification, language)}">
% endif
% else:
% if generate_atom:
- <link rel="alternate" type="application/atom+xml" title="Atom" href="${_link("index_atom", None)}">
+ <link rel="alternate" type="application/atom+xml" title="Atom (${language})" href="${_link("index_atom", None, language)}">
% endif
% if generate_rss and not rss_link:
- <link rel="alternate" type="application/rss+xml" title="RSS" href="${_link("rss", None)}">
+ <link rel="alternate" type="application/rss+xml" title="RSS (${language})" href="${_link("rss", None, language)}">
% endif
% endif
+ % endfor
+ % else:
+ % if classification:
+ % if generate_atom:
+ <link rel="alternate" type="application/atom+xml" title="Atom for ${kind} ${classification|h}" href="${_link(kind + "_atom", classification)}">
+ % endif
+ % if generate_rss and not rss_link:
+ <link rel="alternate" type="application/rss+xml" title="RSS for ${kind} ${classification|h}" href="${_link(kind + "_rss", classification)}">
+ % endif
+ % else:
+ % if generate_atom:
+ <link rel="alternate" type="application/atom+xml" title="Atom" href="${_link("index_atom", None)}">
+ % endif
+ % if generate_rss and not rss_link:
+ <link rel="alternate" type="application/rss+xml" title="RSS" href="${_link("rss", None)}">
+ % endif
% endif
% endif
+ % if has_other_languages:
+ % for language, classification, _ in other_languages:
+ <link rel="alternate" hreflang="${language}" href="${_link(kind, classification, language)}">
+ % endfor
+ % endif
</%def>
<%def name="link(classification)">
- % if has_other_languages:
- %for language, classification, _ in all_languages:
+ % if len(translations) > 1:
+ % for language in sorted(translations):
% if generate_atom or generate_rss:
<p class="feedlink">
% if generate_atom:
<a href="${_link(kind + "_atom", classification, language)}" hreflang="${language}" type="application/atom+xml">${messages('Atom feed', language)} (${language})</a>
% endif
% if generate_rss:
- <a href="${_link(kind + "_rss", classification, language)}" hreflang="${language}" type="application/rss+xml">${messages('RSS feed', language)} (${language})</a>
+ <a href="${_link(kind + "_rss" if classification else "rss", classification, language)}" hreflang="${language}" type="application/rss+xml">${messages('RSS feed', language)} (${language})</a>
% endif
</p>
% endif
- %endfor
+ % endfor
% else:
- % if len(translations) > 1:
- % for language in sorted(translations):
- % if generate_atom or generate_rss:
- <p class="feedlink">
- % if generate_atom:
- <a href="${_link(kind + "_atom", classification, language)}" hreflang="${language}" type="application/atom+xml">${messages('Atom feed', language)} (${language})</a>
- % endif
- % if generate_rss:
- <a href="${_link(kind + "_rss", classification, language)}" hreflang="${language}" type="application/rss+xml">${messages('RSS feed', language)} (${language})</a>
- % endif
- </p>
+ % if generate_atom or generate_rss:
+ <p class="feedlink">
+ % if generate_atom:
+ <a href="${_link(kind + "_atom", classification)}" type="application/atom+xml">${messages('Atom feed')}</a>
% endif
- % endfor
- % else:
- % if generate_atom or generate_rss:
- <p class="feedlink">
- % if generate_atom:
- <a href="${_link(kind + "_atom", classification)}" type="application/atom+xml">${messages('Atom feed')}</a>
- % endif
- % if generate_rss:
- <a href="${_link(kind + "_rss", classification)}" type="application/rss+xml">${messages('RSS feed')}</a>
- % endif
- </p>
- % endif
+ % if generate_rss:
+ <a href="${_link(kind + "_rss" if classification else "rss", classification)}" type="application/rss+xml">${messages('RSS feed')}</a>
+ % endif
+ </p>
% endif
% endif
- %if has_other_languages and other_languages:
+ % 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:
+ % for language, classification, name in other_languages:
<p><a href="${_link(kind, classification, language)}" rel="alternate">${messages("LANGUAGE", language)}
- %if kind != 'archive':
+ % if kind != 'archive':
(${name|h})
- %endif
+ % endif
</a></p>
- %endfor
+ % endfor
</div>
- %endif
+ % endif
</%def>
@@ -331,7 +331,6 @@ def _generate_classification_page(self, taxonomy, classification, filtered_posts
context = copy(context)
context["permalink"] = self.site.link(taxonomy.classification_name, classification, lang)
context["kind"] = taxonomy.classification_name
- context["generate_rss"] = self.site.config['GENERATE_RSS'] and not taxonomy.always_disable_rss
# Get links to other language versions of this classification
if classification_set_per_lang is not None:
other_lang_links = taxonomy.get_other_language_variants(classification, lang, classification_set_per_lang)

0 comments on commit 364ed55

Please sign in to comment.