diff options
Diffstat (limited to 'nikola/data/themes/base-jinja')
46 files changed, 726 insertions, 304 deletions
diff --git a/nikola/data/themes/base-jinja/AUTHORS.txt b/nikola/data/themes/base-jinja/AUTHORS.txt deleted file mode 100644 index 043d497..0000000 --- a/nikola/data/themes/base-jinja/AUTHORS.txt +++ /dev/null @@ -1 +0,0 @@ -Roberto Alsina <https://github.com/ralsina> diff --git a/nikola/data/themes/base-jinja/base-jinja.theme b/nikola/data/themes/base-jinja/base-jinja.theme new file mode 100644 index 0000000..64dc002 --- /dev/null +++ b/nikola/data/themes/base-jinja/base-jinja.theme @@ -0,0 +1,10 @@ +[Theme] +engine = jinja +parent = base +author = The Nikola Contributors +author_url = https://getnikola.com/ +license = MIT + +[Family] +family = base +mako_version = base diff --git a/nikola/data/themes/base-jinja/bundles b/nikola/data/themes/base-jinja/bundles deleted file mode 100644 index 4760181..0000000 --- a/nikola/data/themes/base-jinja/bundles +++ /dev/null @@ -1,2 +0,0 @@ -assets/css/all.css=rst.css,code.css,theme.css -assets/css/all-nocdn.css=rst.css,code.css,theme.css diff --git a/nikola/data/themes/base-jinja/engine b/nikola/data/themes/base-jinja/engine deleted file mode 100644 index 6f04b30..0000000 --- a/nikola/data/themes/base-jinja/engine +++ /dev/null @@ -1 +0,0 @@ -jinja diff --git a/nikola/data/themes/base-jinja/parent b/nikola/data/themes/base-jinja/parent deleted file mode 100644 index df967b9..0000000 --- a/nikola/data/themes/base-jinja/parent +++ /dev/null @@ -1 +0,0 @@ -base diff --git a/nikola/data/themes/base-jinja/templates/archive.tmpl b/nikola/data/themes/base-jinja/templates/archive.tmpl new file mode 100644 index 0000000..f2b715d --- /dev/null +++ b/nikola/data/themes/base-jinja/templates/archive.tmpl @@ -0,0 +1 @@ +{% extends 'list_post.tmpl' %} diff --git a/nikola/data/themes/base-jinja/templates/archive_navigation_helper.tmpl b/nikola/data/themes/base-jinja/templates/archive_navigation_helper.tmpl new file mode 100644 index 0000000..ce913a3 --- /dev/null +++ b/nikola/data/themes/base-jinja/templates/archive_navigation_helper.tmpl @@ -0,0 +1,27 @@ +{# -*- coding: utf-8 -*- #} + +{% macro archive_navigation() %} +{% if 'archive_page' in pagekind %} + {% if has_archive_navigation %} + <nav class="archivenav"> + <ul class="pager"> + {% if previous_archive %} + <li class="previous"><a href="{{ previous_archive }}" rel="prev">{{ messages("Previous") }}</a></li> + {% else %} + <li class="previous disabled"><a href="#" rel="prev">{{ messages("Previous") }}</a></li> + {% endif %} + {% if up_archive %} + <li class="up"><a href="{{ up_archive }}" rel="up">{{ messages("Up") }}</a></li> + {% else %} + <li class="up disabled"><a href="#" rel="up">{{ messages("Up") }}</a></li> + {% endif %} + {% if next_archive %} + <li class="next"><a href="{{ next_archive }}" rel="next">{{ messages("Next") }}</a></li> + {% else %} + <li class="next disabled"><a href="#" rel="next">{{ messages("Next") }}</a></li> + {% endif %} + </ul> + </nav> + {% endif %} +{% endif %} +{% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/archiveindex.tmpl b/nikola/data/themes/base-jinja/templates/archiveindex.tmpl index 8b9286e..a8bc9c6 100644 --- a/nikola/data/themes/base-jinja/templates/archiveindex.tmpl +++ b/nikola/data/themes/base-jinja/templates/archiveindex.tmpl @@ -1,13 +1,20 @@ {# -*- coding: utf-8 -*- #} {% extends 'index.tmpl' %} +{% import 'archive_navigation_helper.tmpl' as archive_nav with context %} +{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %} {% block extra_head %} {{ super() }} - {% if translations|length > 1 and generate_atom %} - {% for language in translations|sort %} - <link rel="alternate" type="application/atom+xml" title="Atom for the {{ archive_name }} section ({{ language }})" href="{{ _link("archive_atom", archive_name, language) }}"> - {% endfor %} - {% elif generate_atom %} - <link rel="alternate" type="application/atom+xml" title="Atom for the {{ archive_name }} archive" href="{{ _link("archive_atom", archive_name) }}"> - {% endif %} + {{ feeds_translations.head(archive_name, kind, rss_override=False) }} +{% endblock %} + +{% block content_header %} + <header> + <h1>{{ title|e }}</h1> + {{ archive_nav.archive_navigation() }} + <div class="metadata"> + {{ feeds_translations.feed_link(archive, kind) }} + {{ feeds_translations.translation_link(kind) }} + </div> + </header> {% endblock %} diff --git a/nikola/data/themes/base-jinja/templates/author.tmpl b/nikola/data/themes/base-jinja/templates/author.tmpl new file mode 100644 index 0000000..4d8a876 --- /dev/null +++ b/nikola/data/themes/base-jinja/templates/author.tmpl @@ -0,0 +1,28 @@ +{# -*- coding: utf-8 -*- #} +{% extends 'list_post.tmpl' %} +{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %} + +{% block extra_head %} + {{ feeds_translations.head(author, kind, rss_override=False) }} +{% endblock %} + +{% block content %} +<article class="authorpage"> + <header> + <h1>{{ title|e }}</h1> + {% if description %} + <p>{{ description }}</p> + {% endif %} + <div class="metadata"> + {{ feeds_translations.feed_link(author, kind) }} + </div> + </header> + {% if posts %} + <ul class="postlist"> + {% for post in posts %} + <li><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time> <a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a></li> + {% endfor %} + </ul> + {% endif %} +</article> +{% endblock %} diff --git a/nikola/data/themes/base-jinja/templates/authorindex.tmpl b/nikola/data/themes/base-jinja/templates/authorindex.tmpl new file mode 100644 index 0000000..4b2fcbf --- /dev/null +++ b/nikola/data/themes/base-jinja/templates/authorindex.tmpl @@ -0,0 +1,21 @@ +{# -*- coding: utf-8 -*- #} +{% extends 'index.tmpl' %} +{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %} + +{% block content_header %} + <header> + <h1>{{ title|e }}</h1> + {% if description %} + <p>{{ description }}</p> + {% endif %} + <div class="metadata"> + {{ feeds_translations.feed_link(author, kind) }} + {{ feeds_translations.translation_link(kind) }} + </div> + </header> +{% endblock %} + +{% block extra_head %} + {{ super() }} + {{ feeds_translations.head(author, kind, rss_override=False) }} +{% endblock %} diff --git a/nikola/data/themes/base-jinja/templates/authors.tmpl b/nikola/data/themes/base-jinja/templates/authors.tmpl new file mode 100644 index 0000000..c8e05ff --- /dev/null +++ b/nikola/data/themes/base-jinja/templates/authors.tmpl @@ -0,0 +1,25 @@ +{# -*- coding: utf-8 -*- #} +{% extends 'base.tmpl' %} +{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %} + +{% block extra_head %} + {{ feeds_translations.head(kind=kind, feeds=False) }} +{% endblock %} + +{% block content %} +<article class="authorindex"> + {% if items %} + <h2>{{ messages("Authors") }}</h2> + <div class="metadata"> + {{ feeds_translations.translation_link(kind) }} + </div> + <ul class="postlist"> + {% for text, link in items %} + {% if text not in hidden_authors %} + <li><a class="reference listtitle" href="{{ link }}">{{ text|e }}</a></li> + {% endif %} + {% endfor %} + </ul> + {% endif %} +</article> +{% endblock %} diff --git a/nikola/data/themes/base-jinja/templates/base.tmpl b/nikola/data/themes/base-jinja/templates/base.tmpl index 5412326..8b057db 100644 --- a/nikola/data/themes/base-jinja/templates/base.tmpl +++ b/nikola/data/themes/base-jinja/templates/base.tmpl @@ -2,8 +2,8 @@ {% import 'base_helper.tmpl' as base with context %} {% import 'base_header.tmpl' as header with context %} {% import 'base_footer.tmpl' as footer with context %} -{% import 'annotation_helper.tmpl' as annotations with context %} {{ set_locale(lang) }} +{# <html> tag is included by base.html_headstart #} {{ base.html_headstart() }} {% block extra_head %} {# Leave this block alone. #} @@ -11,16 +11,29 @@ {{ template_hooks['extra_head']() }} </head> <body> -<a href="#content" class="sr-only sr-only-focusable">{{ messages("Skip to main content") }}</a> + <a href="#content" class="sr-only sr-only-focusable">{{ messages("Skip to main content") }}</a> <div id="container"> - {{ header.html_header() }} - <main id="content"> + {{ header.html_header() }} + <main id="content"> {% block content %}{% endblock %} - </main> - {{ footer.html_footer() }} + </main> + {{ footer.html_footer() }} </div> {{ base.late_load_js() }} + {% if date_fanciness != 0 %} + <!-- fancy dates --> + <script> + luxon.Settings.defaultLocale = "{{ luxon_locales[lang] }}"; + fancydates({{ date_fanciness }}, {{ luxon_date_format }}); + </script> + <!-- end fancy dates --> + {% endif %} {% block extra_js %}{% endblock %} + <script> + baguetteBox.run('div#content', { + ignoreClass: 'islink', + captions: function(element){var i=element.getElementsByTagName('img')[0];return i===undefined?'':i.alt;}}); + </script> {{ body_end }} {{ template_hooks['body_end']() }} </body> diff --git a/nikola/data/themes/base-jinja/templates/base_footer.tmpl b/nikola/data/themes/base-jinja/templates/base_footer.tmpl index 2e541a6..db44a67 100644 --- a/nikola/data/themes/base-jinja/templates/base_footer.tmpl +++ b/nikola/data/themes/base-jinja/templates/base_footer.tmpl @@ -1,5 +1,4 @@ {# -*- coding: utf-8 -*- #} -{% import 'base_helper.tmpl' as base with context %} {% macro html_footer() %} {% if content_footer %} diff --git a/nikola/data/themes/base-jinja/templates/base_header.tmpl b/nikola/data/themes/base-jinja/templates/base_header.tmpl index 092abd8..bfbd447 100644 --- a/nikola/data/themes/base-jinja/templates/base_header.tmpl +++ b/nikola/data/themes/base-jinja/templates/base_header.tmpl @@ -16,13 +16,13 @@ {% endmacro %} {% macro html_site_title() %} - <h1 id="brand"><a href="{{ abs_link(_link("root", None, lang)) }}" title="{{ blog_title }}" rel="home"> + <h1 id="brand"><a href="{{ _link("root", None, lang) }}" title="{{ blog_title|e }}" rel="home"> {% if logo_url %} - <img src="{{ logo_url }}" alt="{{ blog_title }}" id="logo"> + <img src="{{ logo_url }}" alt="{{ blog_title|e }}" id="logo"> {% endif %} {% if show_blog_title %} - <span id="blog-title">{{ blog_title }}</span> + <span id="blog-title">{{ blog_title|e }}</span> {% endif %} </a></h1> {% endmacro %} @@ -30,13 +30,22 @@ {% macro html_navigation_links() %} <nav id="menu"> <ul> - {% for url, text in navigation_links[lang] %} + {{ html_navigation_links_entries(navigation_links) }} + {{ html_navigation_links_entries(navigation_alt_links) }} + {{ template_hooks['menu']() }} + {{ template_hooks['menu_alt']() }} + </ul> + </nav> +{% endmacro %} + +{% macro html_navigation_links_entries(navigation_links_source) %} + {% for url, text in navigation_links_source[lang] %} {% if isinstance(url, tuple) %} <li> {{ text }} <ul> {% for suburl, text in url %} {% if rel_link(permalink, suburl) == "#" %} - <li class="active"><a href="{{ permalink }}">{{ text }} <span class="sr-only">{{ messages("(active)", lang) }}</span></a></li> + <li class="active"><a href="{{ permalink }}">{{ text }}<span class="sr-only"> {{ messages("(active)", lang) }}</span></a></li> {% else %} <li><a href="{{ suburl }}">{{ text }}</a></li> {% endif %} @@ -44,16 +53,12 @@ </ul> {% else %} {% if rel_link(permalink, url) == "#" %} - <li class="active"><a href="{{ permalink }}">{{ text }} <span class="sr-only">{{ messages("(active)", lang) }}</span></a></li> + <li class="active"><a href="{{ permalink }}">{{ text }}<span class="sr-only"> {{ messages("(active)", lang) }}</span></a></li> {% else %} <li><a href="{{ url }}">{{ text }}</a></li> {% endif %} {% endif %} {% endfor %} - {{ template_hooks['menu']() }} - {{ template_hooks['menu_alt']() }} - </ul> - </nav> {% endmacro %} {% macro html_translation_header() %} diff --git a/nikola/data/themes/base-jinja/templates/base_helper.tmpl b/nikola/data/themes/base-jinja/templates/base_helper.tmpl index 8b4ed97..a05abb9 100644 --- a/nikola/data/themes/base-jinja/templates/base_helper.tmpl +++ b/nikola/data/themes/base-jinja/templates/base_helper.tmpl @@ -1,29 +1,25 @@ {# -*- coding: utf-8 -*- #} +{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %} {% macro html_headstart() %} <!DOCTYPE html> <html \ -prefix=' -{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) %} -og: http://ogp.me/ns# article: http://ogp.me/ns/article# -{% endif %} -{% if comment_system == 'facebook' %} -fb: http://ogp.me/ns/fb# -{% endif %} -' \ -{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) %} -vocab="http://ogp.me/ns" \ -{% endif %} + prefix=' + og: http://ogp.me/ns# article: http://ogp.me/ns/article# + {% if comment_system == 'facebook' %} + fb: http://ogp.me/ns/fb# + {% endif %} + ' \ + vocab="http://ogp.me/ns" \ {% if is_rtl %} -dir="rtl" + dir="rtl" {% endif %} lang="{{ lang }}"> <head> <meta charset="utf-8"> - <base href="{{ abs_link(permalink) }}"> {% if description %} - <meta name="description" content="{{ description }}"> + <meta name="description" content="{{ description|e }}"> {% endif %} <meta name="viewport" content="width=device-width"> {% if title == blog_title %} @@ -33,7 +29,11 @@ lang="{{ lang }}"> {% endif %} {{ html_stylesheets() }} - {{ html_feedlinks() }} + <meta name="theme-color" content="{{ theme_color }}"> + {% if meta_generator_tag %} + <meta name="generator" content="Nikola (getnikola.com)"> + {% endif %} + {{ feeds_translations.head(classification=None, kind='index', other=False) }} <link rel="canonical" href="{{ abs_link(permalink) }}"> {% if favicons %} @@ -53,29 +53,58 @@ lang="{{ lang }}"> <link rel="next" href="{{ nextlink }}" type="text/html"> {% endif %} - {{ mathjax_config }} {% if use_cdn %} - <!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]--> + <!--[if lt IE 9]><script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script><![endif]--> {% else %} - <!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5.js', lang) }}"></script><![endif]--> + <!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5shiv-printshiv.min.js', lang, url_type) }}"></script><![endif]--> {% endif %} {{ extra_head_data }} {% endmacro %} {% macro late_load_js() %} + {% if use_bundles %} + {% if use_cdn %} + <script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.11.1/baguetteBox.min.js" integrity="sha256-ULQV01VS9LCI2ePpLsmka+W0mawFpEA0rtxnezUj4A4=" crossorigin="anonymous"></script> + <script src="/assets/js/all.js"></script> + {% else %} + <script src="/assets/js/all-nocdn.js"></script> + {% endif %} + {% else %} + {% if use_cdn %} + <script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.11.1/baguetteBox.min.js" integrity="sha256-ULQV01VS9LCI2ePpLsmka+W0mawFpEA0rtxnezUj4A4=" crossorigin="anonymous"></script> + {% else %} + <script src="/assets/js/baguetteBox.min.js"></script> + {% endif %} + {% endif %} + {% if date_fanciness != 0 %} + {% if date_fanciness == 2 %} + <script src="https://polyfill.io/v3/polyfill.js?features=Intl.RelativeTimeFormat.%7Elocale.{{ luxon_locales[lang] }}"></script> + {% endif %} + {% if use_cdn %} + <script src="https://cdn.jsdelivr.net/npm/luxon@1.25.0/build/global/luxon.min.js" integrity="sha256-OVk2fwTRcXYlVFxr/ECXsakqelJbOg5WCj1dXSIb+nU=" crossorigin="anonymous"></script> + {% else %} + <script src="/assets/js/luxon.min.js"></script> + {% endif %} + {% if not use_bundles %} + <script src="/assets/js/fancydates.min.js"></script> + {% endif %} + {% endif %} {{ social_buttons_code }} {% endmacro %} {% macro html_stylesheets() %} {% if use_bundles %} {% if use_cdn %} + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.11.1/baguetteBox.min.css" integrity="sha256-cLMYWYYutHkt+KpNqjg7NVkYSQ+E2VbrXsEvOqU7mL0=" crossorigin="anonymous"> <link href="/assets/css/all.css" rel="stylesheet" type="text/css"> {% else %} <link href="/assets/css/all-nocdn.css" rel="stylesheet" type="text/css"> {% endif %} {% else %} - <link href="/assets/css/rst.css" rel="stylesheet" type="text/css"> + <link href="/assets/css/baguetteBox.min.css" rel="stylesheet" type="text/css"> + <link href="/assets/css/rst_base.css" rel="stylesheet" type="text/css"> + <link href="/assets/css/nikola_rst.css" rel="stylesheet" type="text/css"> <link href="/assets/css/code.css" rel="stylesheet" type="text/css"> <link href="/assets/css/theme.css" rel="stylesheet" type="text/css"> {% if has_custom_css %} @@ -88,34 +117,16 @@ lang="{{ lang }}"> {% endif %} {% endmacro %} +{# This function is deprecated; use feed_helper directly. #} {% macro html_feedlinks() %} - {% if rss_link %} - {{ rss_link }} - {% elif generate_rss %} - {% if translations|length > 1 %} - {% for language in translations|sort %} - <link rel="alternate" type="application/rss+xml" title="RSS ({{ language }})" href="{{ _link('rss', None, language) }}"> - {% endfor %} - {% else %} - <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ _link('rss', None) }}"> - {% endif %} - {% endif %} - {% if generate_atom %} - {% if translations|length > 1 %} - {% for language in translations|sort %} - <link rel="alternate" type="application/atom+xml" title="Atom ({{ language }})" href="{{ _link('index_atom', None, language) }}"> - {% endfor %} - {% else %} - <link rel="alternate" type="application/atom+xml" title="Atom" href="{{ _link('index_atom', None) }}"> - {% endif %} - {% endif %} + {{ feeds_translations.head(classification=None, kind='index', other=False) }} {% endmacro %} {% macro html_translations() %} <ul class="translations"> {% for langname in translations|sort %} {% if langname != lang %} - <li><a href="{{ abs_link(_link("root", None, langname)) }}" rel="alternate" hreflang="{{ langname }}">{{ messages("LANGUAGE", langname) }}</a></li> + <li><a href="{{ _link("root", None, langname) }}" rel="alternate" hreflang="{{ langname }}">{{ messages("LANGUAGE", langname) }}</a></li> {% endif %} {% endfor %} </ul> diff --git a/nikola/data/themes/base-jinja/templates/comments_helper.tmpl b/nikola/data/themes/base-jinja/templates/comments_helper.tmpl index aba7294..2a7d8dc 100644 --- a/nikola/data/themes/base-jinja/templates/comments_helper.tmpl +++ b/nikola/data/themes/base-jinja/templates/comments_helper.tmpl @@ -1,63 +1,63 @@ {# -*- coding: utf-8 -*- #} {% import 'comments_helper_disqus.tmpl' as disqus with context %} -{% import 'comments_helper_livefyre.tmpl' as livefyre with context %} {% import 'comments_helper_intensedebate.tmpl' as intensedebate with context %} {% import 'comments_helper_muut.tmpl' as muut with context %} -{% import 'comments_helper_googleplus.tmpl' as googleplus with context %} {% import 'comments_helper_facebook.tmpl' as facebook with context %} {% import 'comments_helper_isso.tmpl' as isso with context %} +{% import 'comments_helper_commento.tmpl' as commento with context %} +{% import 'comments_helper_utterances.tmpl' as utterances with context %} {% macro comment_form(url, title, identifier) %} {% if comment_system == 'disqus' %} {{ disqus.comment_form(url, title, identifier) }} - {% elif comment_system == 'livefyre' %} - {{ livefyre.comment_form(url, title, identifier) }} {% elif comment_system == 'intensedebate' %} {{ intensedebate.comment_form(url, title, identifier) }} {% elif comment_system == 'muut' %} {{ muut.comment_form(url, title, identifier) }} - {% elif comment_system == 'googleplus' %} - {{ googleplus.comment_form(url, title, identifier) }} {% elif comment_system == 'facebook' %} {{ facebook.comment_form(url, title, identifier) }} {% elif comment_system == 'isso' %} {{ isso.comment_form(url, title, identifier) }} + {% elif comment_system == 'commento' %} + {{ commento.comment_form(url, title, identifier) }} + {% elif comment_system == 'utterances' %} + {{ utterances.comment_form(url, title, identifier) }} {% endif %} {% endmacro %} {% macro comment_link(link, identifier) %} {% if comment_system == 'disqus' %} {{ disqus.comment_link(link, identifier) }} - {% elif comment_system == 'livefyre' %} - {{ livefyre.comment_link(link, identifier) }} {% elif comment_system == 'intensedebate' %} {{ intensedebate.comment_link(link, identifier) }} {% elif comment_system == 'muut' %} {{ muut.comment_link(link, identifier) }} - {% elif comment_system == 'googleplus' %} - {{ googleplus.comment_link(link, identifier) }} {% elif comment_system == 'facebook' %} {{ facebook.comment_link(link, identifier) }} {% elif comment_system == 'isso' %} {{ isso.comment_link(link, identifier) }} + {% elif comment_system == 'commento' %} + {{ commento.comment_link(link, identifier) }} + {% elif comment_system == 'utterances' %} + {{ utterances.comment_link(link, identifier) }} {% endif %} {% endmacro %} {% macro comment_link_script() %} {% if comment_system == 'disqus' %} {{ disqus.comment_link_script() }} - {% elif comment_system == 'livefyre' %} - {{ livefyre.comment_link_script() }} {% elif comment_system == 'intensedebate' %} {{ intensedebate.comment_link_script() }} {% elif comment_system == 'muut' %} {{ muut.comment_link_script() }} - {% elif comment_system == 'googleplus' %} - {{ googleplus.comment_link_script() }} {% elif comment_system == 'facebook' %} {{ facebook.comment_link_script() }} {% elif comment_system == 'isso' %} {{ isso.comment_link_script() }} + {% elif comment_system == 'commento' %} + {{ commento.comment_link_script() }} + {% elif comment_system == 'utterances' %} + {{ utterances.comment_link_script() }} {% endif %} {% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/comments_helper_commento.tmpl b/nikola/data/themes/base-jinja/templates/comments_helper_commento.tmpl new file mode 100644 index 0000000..25857d9 --- /dev/null +++ b/nikola/data/themes/base-jinja/templates/comments_helper_commento.tmpl @@ -0,0 +1,13 @@ +{# -*- coding: utf-8 -*- #} +{% macro comment_form(url, title, identifier) %} + <div id="commento"></div> + + <script defer src="{{ comment_system_id }}/js/commento.js"></script> +{% endmacro %} + +{% macro comment_link(link, identifier) %} + <a href="{{ link }}#commento">{{ messages("Comments") }}</a> +{% endmacro %} + +{% macro comment_link_script() %} +{% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/comments_helper_disqus.tmpl b/nikola/data/themes/base-jinja/templates/comments_helper_disqus.tmpl index 0d40b0b..4aa42fa 100644 --- a/nikola/data/themes/base-jinja/templates/comments_helper_disqus.tmpl +++ b/nikola/data/themes/base-jinja/templates/comments_helper_disqus.tmpl @@ -19,24 +19,24 @@ }; (function() { var dsq = document.createElement('script'); dsq.async = true; - dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; + dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> - <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript> - <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a> + <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript> + <a href="https://disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a> {% endif %} {% endmacro %} {% macro comment_link(link, identifier) %} {% if comment_system_id %} - <a href="{{ link }}#disqus_thread" data-disqus-identifier="{{ identifier }}">Comments</a> + <a href="{{ link }}#disqus_thread" data-disqus-identifier="{{ identifier }}">{{ messages("Comments") }}</a> {% endif %} {% endmacro %} {% macro comment_link_script() %} {% if comment_system_id %} - <script>var disqus_shortname="{{ comment_system_id }}";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script> + <script>var disqus_shortname="{{ comment_system_id }}";(function(){var a=document.createElement("script");a.async=true;a.src="https://"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script> {% endif %} {% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/comments_helper_facebook.tmpl b/nikola/data/themes/base-jinja/templates/comments_helper_facebook.tmpl index 21dac2a..0b0808a 100644 --- a/nikola/data/themes/base-jinja/templates/comments_helper_facebook.tmpl +++ b/nikola/data/themes/base-jinja/templates/comments_helper_facebook.tmpl @@ -17,7 +17,7 @@ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; - js.src = "//connect.facebook.net/en_US/all.js"; + js.src = "https://connect.facebook.net/en_US/all.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> @@ -55,7 +55,7 @@ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; - js.src = "//connect.facebook.net/en_US/all.js"; + js.src = "https://connect.facebook.net/en_US/all.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> diff --git a/nikola/data/themes/base-jinja/templates/comments_helper_googleplus.tmpl b/nikola/data/themes/base-jinja/templates/comments_helper_googleplus.tmpl deleted file mode 100644 index cf153e0..0000000 --- a/nikola/data/themes/base-jinja/templates/comments_helper_googleplus.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -{# -*- coding: utf-8 -*- #} -{% macro comment_form(url, title, identifier) %} -<script src="https://apis.google.com/js/plusone.js"></script> -<div class="g-comments" - data-href="{{ url }}" - data-first_party_property="BLOGGER" - data-view_type="FILTERED_POSTMOD"> -</div> -{% endmacro %} - -{% macro comment_link(link, identifier) %} -<div class="g-commentcount" data-href="{{ link }}"></div> -<script src="https://apis.google.com/js/plusone.js"></script> -{% endmacro %} - -{% macro comment_link_script() %} -{% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/comments_helper_intensedebate.tmpl b/nikola/data/themes/base-jinja/templates/comments_helper_intensedebate.tmpl index 042409b..d649d31 100644 --- a/nikola/data/themes/base-jinja/templates/comments_helper_intensedebate.tmpl +++ b/nikola/data/themes/base-jinja/templates/comments_helper_intensedebate.tmpl @@ -6,7 +6,7 @@ var idcomments_post_id = "{{ identifier }}"; var idcomments_post_url = "{{ url }}"; </script> <span id="IDCommentsPostTitle" style="display:none"></span> -<script src='http://www.intensedebate.com/js/genericCommentWrapperV2.js'></script> +<script src="https://www.intensedebate.com/js/genericCommentWrapperV2.js"></script> </script> {% endmacro %} @@ -17,7 +17,7 @@ var idcomments_acct = '{{ comment_system_id }}'; var idcomments_post_id = "{{ identifier }}"; var idcomments_post_url = "{{ link }}"; </script> -<script src="http://www.intensedebate.com/js/genericLinkWrapperV2.js"></script> +<script src="https://www.intensedebate.com/js/genericLinkWrapperV2.js"></script> </a> {% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/comments_helper_isso.tmpl b/nikola/data/themes/base-jinja/templates/comments_helper_isso.tmpl index 22a9595..43995c5 100644 --- a/nikola/data/themes/base-jinja/templates/comments_helper_isso.tmpl +++ b/nikola/data/themes/base-jinja/templates/comments_helper_isso.tmpl @@ -1,20 +1,26 @@ {# -*- coding: utf-8 -*- #} {% macro comment_form(url, title, identifier) %} {% if comment_system_id %} - <div data-title="{{ title|urlencode }}" id="isso-thread"></div> - <script src="{{ comment_system_id }}js/embed.min.js" data-isso="{{ comment_system_id }}"></script> + <div data-title="{{ title|e }}" id="isso-thread"></div> + <script src="{{ comment_system_id }}js/embed.min.js" data-isso="{{ comment_system_id }}" data-isso-lang="{{ lang }}" + {% if isso_config %} + {% for k, v in isso_config.items() %} + data-isso-{{ k }}="{{ v }}" + {% endfor %} + {% endif %} + ></script> {% endif %} {% endmacro %} {% macro comment_link(link, identifier) %} {% if comment_system_id %} - <a href="{{ link }}#isso-thread">Comments</a> + <a href="{{ link }}#isso-thread">{{ messages("Comments") }}</a> {% endif %} {% endmacro %} {% macro comment_link_script() %} - {% if comment_system_id %} - <script src="{{ comment_system_id }}js/count.min.js" data-isso="{{ comment_system_id }}"></script> + {% if comment_system_id and 'index' in pagekind %} + <script src="{{ comment_system_id }}js/count.min.js" data-isso="{{ comment_system_id }}" data-isso-lang="{{ lang }}"></script> {% endif %} {% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/comments_helper_livefyre.tmpl b/nikola/data/themes/base-jinja/templates/comments_helper_livefyre.tmpl deleted file mode 100644 index 5b01fbf..0000000 --- a/nikola/data/themes/base-jinja/templates/comments_helper_livefyre.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -{# -*- coding: utf-8 -*- #} -{% macro comment_form(url, title, identifier) %} -<div id="livefyre-comments"></div> -<script src="http://zor.livefyre.com/wjs/v3.0/javascripts/livefyre.js"></script> -<script> -(function () { - var articleId = "{{ identifier }}"; - fyre.conv.load({}, [{ - el: 'livefyre-comments', - network: "livefyre.com", - siteId: "{{ comment_system_id }}", - articleId: articleId, - signed: false, - collectionMeta: { - articleId: articleId, - url: fyre.conv.load.makeCollectionUrl(), - } - }], function() {}); -}()); -</script> -{% endmacro %} - -{% macro comment_link(link, identifier) %} - <a href="{{ link }}"> - <span class="livefyre-commentcount" data-lf-site-id="{{ comment_system_id }}" data-lf-article-id="{{ identifier }}"> - 0 Comments - </span> -{% endmacro %} - - -{% macro comment_link_script() %} -<script src="http://zor.livefyre.com/wjs/v1.0/javascripts/CommentCount.js"></script> -{% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/comments_helper_mustache.tmpl b/nikola/data/themes/base-jinja/templates/comments_helper_mustache.tmpl deleted file mode 100644 index 8912e19..0000000 --- a/nikola/data/themes/base-jinja/templates/comments_helper_mustache.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -{# -*- coding: utf-8 -*- #} -{% import 'comments_helper.tmpl' as comments with context %} -{% if not post.meta('nocomments') %} - {{ comments.comment_form(post.permalink(absolute=True), post.title(), post.base_path) }} -{% endif %} diff --git a/nikola/data/themes/base-jinja/templates/comments_helper_muut.tmpl b/nikola/data/themes/base-jinja/templates/comments_helper_muut.tmpl index 79ae523..ebc0541 100644 --- a/nikola/data/themes/base-jinja/templates/comments_helper_muut.tmpl +++ b/nikola/data/themes/base-jinja/templates/comments_helper_muut.tmpl @@ -9,5 +9,5 @@ {% macro comment_link_script() %} -<script src="//cdn.muut.com/1/moot.min.js"></script> +<script src="https://cdn.muut.com/1/moot.min.js"></script> {% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/comments_helper_utterances.tmpl b/nikola/data/themes/base-jinja/templates/comments_helper_utterances.tmpl new file mode 100644 index 0000000..e1c03c2 --- /dev/null +++ b/nikola/data/themes/base-jinja/templates/comments_helper_utterances.tmpl @@ -0,0 +1,23 @@ +{# -*- coding: utf-8 -*- #} +{% macro comment_form(url, title, identifier) %} + {% if comment_system_id %} + <div data-title="{{ title|e }}" id="utterances-thread"></div> + <script src="https://utteranc.es/client.js" repo="{{ comment_system_id }}" + {% if utterances_config %} + {% for k, v in utterances_config.items() %} + {{ k }}="{{ v }}" + {% endfor %} + {% endif %} + ></script> + {% endif %} +{% endmacro %} + +{% macro comment_link(link, identifier) %} + {% if comment_system_id %} + <a href="{{ link }}#utterances-thread">{{ messages("Comments") }}</a> + {% endif %} +{% endmacro %} + + +{% macro comment_link_script() %} +{% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/feeds_translations_helper.tmpl b/nikola/data/themes/base-jinja/templates/feeds_translations_helper.tmpl new file mode 100644 index 0000000..278e1c4 --- /dev/null +++ b/nikola/data/themes/base-jinja/templates/feeds_translations_helper.tmpl @@ -0,0 +1,124 @@ +{# -*- coding: utf-8 -*- #} + +{% macro _head_feed_link(link_type, link_name, link_postfix, classification, kind, language) %} + {% if translations|length > 1 %} + <link rel="alternate" type="{{ link_type }}" title="{{ link_name|e }} ({{ language }})" hreflang="{{ language }}" href="{{ _link(kind + '_' + link_postfix, classification, language) }}"> + {% else %} + <link rel="alternate" type="{{ link_type }}" title="{{ link_name|e }}" hreflang="{{ language }}" href="{{ _link(kind + '_' + link_postfix, classification, language) }}"> + {% endif %} +{% endmacro %} + +{% macro _html_feed_link(link_type, link_name, link_postfix, classification, kind, language, name=None) %} + {% if translations|length > 1 %} + {% if name and kind != "archive" and kind != "author" %} + <a href="{{ _link(kind + '_' + link_postfix, classification, language) }}" hreflang="{{ language }}" type="{{ link_type }}">{{ messages(link_name, language) }} ({{ name|e }}, {{ language }})</a> + {% else %} + <a href="{{ _link(kind + '_' + link_postfix, classification, language) }}" hreflang="{{ language }}" type="{{ link_type }}">{{ messages(link_name, language) }} ({{ language }})</a> + {% endif %} + {% else %} + {% if name and kind != "archive" and kind != "author" %} + <a href="{{ _link(kind + '_' + link_postfix, classification, language) }}" hreflang="{{ language }}" type="{{ link_type }}">{{ messages(link_name, language) }} ({{ name|e }})</a> + {% else %} + <a href="{{ _link(kind + '_' + link_postfix, classification, language) }}" hreflang="{{ language }}" type="{{ link_type }}">{{ messages(link_name, language) }}</a> + {% endif %} + {% endif %} +{% endmacro %} + +{% macro _html_translation_link(classification, kind, language, name=None) %} + {% if name and kind != "archive" and kind != "author" %} + <a href="{{ _link(kind, classification, language) }}" hreflang="{{ language }}" rel="alternate">{{ messages("LANGUAGE", language) }} ({{ name|e }})</a> + {% else %} + <a href="{{ _link(kind, classification, language) }}" hreflang="{{ language }}" rel="alternate">{{ messages("LANGUAGE", language) }}</a> + {% endif %} +{% endmacro %} + +{% macro _head_rss(classification=None, kind='index', rss_override=True) %} + {% if rss_link and rss_override %} + {{ rss_link }} + {% endif %} + {% if generate_rss and not (rss_link and rss_override) and kind != 'archive' %} + {% if translations|length > 1 and has_other_languages and classification and kind != 'index' %} + {% for language, classification, name in all_languages %} + <link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ name|e }} ({{ language }})" hreflang="{{ language }}" href="{{ _link(kind + "_rss", classification, language) }}"> + {% endfor %} + {% else %} + {% for language in translations_feedorder %} + {% if (classification or classification == '') and kind != 'index' %} + {{ _head_feed_link('application/rss+xml', 'RSS for ' + kind + ' ' + classification, 'rss', classification, kind, language) }} + {% else %} + {{ _head_feed_link('application/rss+xml', 'RSS', 'rss', classification, 'index', language) }} + {% endif %} + {% endfor %} + {% endif %} + {% endif %} +{% endmacro %} + +{% macro _head_atom(classification=None, kind='index') %} + {% if generate_atom %} + {% if translations|length > 1 and has_other_languages and classification and kind != 'index' %} + {% for language, classification, name in all_languages %} + <link rel="alternate" type="application/atom+xml" title="Atom for {{ kind }} {{ name|e }} ({{ language }})" hreflang="{{ language }}" href="{{ _link(kind + "_atom", classification, language) }}"> + {% endfor %} + {% else %} + {% for language in translations_feedorder %} + {% if (classification or classification == '') and kind != 'index' %} + {{ _head_feed_link('application/atom+xml', 'Atom for ' + kind + ' ' + classification, 'atom', classification, kind, language) }} + {% else %} + {{ _head_feed_link('application/atom+xml', 'Atom', 'atom', classification, 'index', language) }} + {% endif %} + {% endfor %} + {% endif %} + {% endif %} +{% endmacro %} + +{# Handles both feeds and translations #} +{% macro head(classification=None, kind='index', feeds=True, other=True, rss_override=True, has_no_feeds=False) %} + {% if feeds and not has_no_feeds %} + {{ _head_rss(classification, 'index' if (kind == 'archive' and rss_override) else kind, rss_override) }} + {{ _head_atom(classification, kind) }} + {% endif %} + {% if other and 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 feed_link(classification, kind) %} + {% if generate_atom or generate_rss %} + {% if translations|length > 1 and has_other_languages and kind != 'index' %} + {% for language, classification, name in all_languages %} + <p class="feedlink"> + {% if generate_atom %} + {{ _html_feed_link('application/atom+xml', 'Atom feed', 'atom', classification, kind, language, name) }} + {% endif %} + {% if generate_rss and kind != 'archive' %} + {{ _html_feed_link('application/rss+xml', 'RSS feed', 'rss', classification, kind, language, name) }} + {% endif %} + </p> + {% endfor %} + {% else %} + {% for language in translations_feedorder %} + <p class="feedlink"> + {% if generate_atom %} + {{ _html_feed_link('application/atom+xml', 'Atom feed', 'atom', classification, kind, language) }} + {% endif %} + {% if generate_rss and kind != 'archive' %} + {{ _html_feed_link('application/rss+xml', 'RSS feed', 'rss', classification, kind, language) }} + {% endif %} + </p> + {% endfor %} + {% endif %} + {% endif %} +{% endmacro %} + +{% macro translation_link(kind) %} + {% 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>{{ _html_translation_link(classification, kind, language, name) }}</p> + {% endfor %} + </div> + {% endif %} +{% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/gallery.tmpl b/nikola/data/themes/base-jinja/templates/gallery.tmpl index 0a53ebe..d425106 100644 --- a/nikola/data/themes/base-jinja/templates/gallery.tmpl +++ b/nikola/data/themes/base-jinja/templates/gallery.tmpl @@ -1,11 +1,12 @@ {# -*- coding: utf-8 -*- #} {% extends 'base.tmpl' %} {% import 'comments_helper.tmpl' as comments with context %} -{% import 'crumbs.tmpl' as ui with context %} +{% import 'ui_helper.tmpl' as ui with context %} +{% import 'post_helper.tmpl' as post_helper with context %} {% block sourcelink %}{% endblock %} {% block content %} - {{ ui.bar(crumbs) }} + {{ ui.breadcrumbs(crumbs) }} {% if title %} <h1>{{ title|e }}</h1> {% endif %} @@ -15,21 +16,39 @@ </p> {% endif %} {% if folders %} - <ul> - {% for folder, ftitle in folders %} - <li><a href="{{ folder }}"><i - class="icon-folder-open"></i> {{ ftitle }}</a></li> - {% endfor %} - </ul> - {% endif %} - {% if photo_array %} - <ul class="thumbnails"> - {% for image in photo_array %} - <li><a href="{{ image['url'] }}" class="thumbnail image-reference" title="{{ image['title'] }}"> - <img src="{{ image['url_thumb'] }}" alt="{{ image['title'] }}" /></a> - {% endfor %} - </ul> + {% if galleries_use_thumbnail %} + {% for (folder, ftitle, fpost) in folders %} + <div class="thumnbnail-container"> + <a href="{{ folder }}" class="thumbnail image-reference" title="{{ ftitle|e }}"> + {% if fpost and fpost.previewimage %} + <img src="{{ fpost.previewimage }}" alt="{{ ftitle|e }}" loading="lazy" style="max-width:{{ thumbnail_size }}px; max-height:{{ thumbnail_size }}px;" /> + {% else %} + <div style="height: {{ thumbnail_size }}px; width: {{ thumbnail_size }}px; background-color: #eee;"></div> + {% endif %} + <p class="thumbnail-caption">{{ ftitle|e }}</p> + </a> + </div> + {% endfor %} + {% else %} + <ul> + {% for folder, ftitle in folders %} + <li><a href="{{ folder }}">📂 {{ ftitle|e }}</a></li> + {% endfor %} + </ul> + {% endif %} {% endif %} + +<div id="gallery_container"></div> +{% if photo_array %} +<noscript> +<ul class="thumbnails"> + {% for image in photo_array %} + <li><a href="{{ image['url'] }}" class="thumbnail image-reference" title="{{ image['title']|e }}"> + <img src="{{ image['url_thumb'] }}" alt="{{ image['title']|e }}" loading="lazy" /></a> + {% endfor %} +</ul> +</noscript> +{% endif %} {% if site_has_comments and enable_comments %} {{ comments.comment_form(None, permalink, title) }} {% endif %} @@ -38,4 +57,35 @@ {% block extra_head %} {{ super() }} <link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml"> +<style type="text/css"> + #gallery_container { + position: relative; + } + .image-block { + position: absolute; + } +</style> +{% if translations|length > 1 %} + {% for langname in translations.keys() %} + {% if langname != lang %} + <link rel="alternate" hreflang="{{ langname }}" href="{{ _link('gallery', gallery_path, langname) }}"> + {% endif %} + {% endfor %} +{% endif %} +<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml"> +{% if post %} + {{ post_helper.open_graph_metadata(post) }} + {{ post_helper.twitter_card_information(post) }} +{% endif %} +{% endblock %} + +{% block extra_js %} +<script src="/assets/js/justified-layout.min.js"></script> +<script src="/assets/js/gallery.min.js"></script> +<script> +var jsonContent = {{ photo_array_json }}; +var thumbnailSize = {{ thumbnail_size }}; +renderGallery(jsonContent, thumbnailSize); +window.addEventListener('resize', function(){renderGallery(jsonContent, thumbnailSize)}); +</script> {% endblock %} diff --git a/nikola/data/themes/base-jinja/templates/index.tmpl b/nikola/data/themes/base-jinja/templates/index.tmpl index 222da43..55ae9aa 100644 --- a/nikola/data/themes/base-jinja/templates/index.tmpl +++ b/nikola/data/themes/base-jinja/templates/index.tmpl @@ -1,6 +1,9 @@ {# -*- coding: utf-8 -*- #} {% import 'index_helper.tmpl' as helper with context %} +{% import 'math_helper.tmpl' as math with context %} {% import 'comments_helper.tmpl' as comments with context %} +{% import 'pagination_helper.tmpl' as pagination with context %} +{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %} {% extends 'base.tmpl' %} {% block extra_head %} @@ -8,18 +11,45 @@ {% if posts and (permalink == '/' or permalink == '/' + index_file) %} <link rel="prefetch" href="{{ posts[0].permalink() }}" type="text/html"> {% endif %} + {{ math.math_styles_ifposts(posts) }} {% endblock %} {% block content %} -{% block content_header %}{% endblock %} +{% block content_header %} + {{ feeds_translations.translation_link(kind) }} +{% endblock %} +{% if 'main_index' in pagekind %} + {{ front_index_header }} +{% endif %} +{% if page_links %} + {{ pagination.page_navigation(current_page, page_links, prevlink, nextlink, prev_next_links_reversed) }} +{% endif %} <div class="postindex"> {% for post in posts %} - <article class="h-entry post-{{ post.meta('type') }}"> + <article class="h-entry post-{{ post.meta('type') }}" itemscope="itemscope" itemtype="http://schema.org/Article"> <header> <h1 class="p-name entry-title"><a href="{{ post.permalink() }}" class="u-url">{{ post.title()|e }}</a></h1> <div class="metadata"> - <p class="byline author vcard"><span class="byline-name fn">{{ post.author() }}</span></p> - <p class="dateline"><a href="{{ post.permalink() }}" rel="bookmark"><time class="published dt-published" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format) }}">{{ post.formatted_date(date_format) }}</time></a></p> + <p class="byline author vcard"><span class="byline-name fn" itemprop="author"> + {% if author_pages_generated and multiple_authors_per_post %} + {% for author in post.authors() %} + <a href="{{ _link('author', author) }}">{{ author|e }}</a> + {% endfor %} + {% elif author_pages_generated %} + <a href="{{ _link('author', post.author()) }}">{{ post.author()|e }}</a> + {% else %} + {{ post.author()|e }} + {% endif %} + </span></p> + <p class="dateline"> + <a href="{{ post.permalink() }}" rel="bookmark"> + <time class="published dt-published" datetime="{{ post.formatted_date('webiso') }}" itemprop="datePublished" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time> + {% if post.updated and post.updated != post.date %} + <span class="updated"> ({{ messages("updated") }} + <time class="dt-updated" datetime="{{ post.formatted_updated('webiso') }}" itemprop="dateUpdated" title="{{ post.formatted_updated(date_format)|e }}">{{ post.formatted_updated(date_format)|e }}</time>)</span> + {% endif %} + </a> + </p> {% if not post.meta('nocomments') and site_has_comments %} <p class="commentline">{{ comments.comment_link(post.permalink(), post._base_path) }} {% endif %} @@ -38,5 +68,5 @@ </div> {{ helper.html_pager() }} {{ comments.comment_link_script() }} -{{ helper.mathjax_script(posts) }} +{{ math.math_scripts_ifposts(posts) }} {% endblock %} diff --git a/nikola/data/themes/base-jinja/templates/index_helper.tmpl b/nikola/data/themes/base-jinja/templates/index_helper.tmpl index 2f9e8ea..bc57734 100644 --- a/nikola/data/themes/base-jinja/templates/index_helper.tmpl +++ b/nikola/data/themes/base-jinja/templates/index_helper.tmpl @@ -1,4 +1,5 @@ {# -*- coding: utf-8 -*- #} +{% import 'math_helper.tmpl' as math with context %} {% macro html_pager() %} {% if prevlink or nextlink %} <nav class="postindexpager"> @@ -18,10 +19,7 @@ {% endif %} {% endmacro %} +{# This function is deprecated; use math_helper directly. #} {% macro mathjax_script(posts) %} - {% if posts|selectattr("is_mathjax")|list %} - <script type="text/x-mathjax-config"> - MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});</script> - <script src="/assets/js/mathjax.js"></script> - {% endif %} + {{ math.math_scripts_ifposts(posts) }} {% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/list.tmpl b/nikola/data/themes/base-jinja/templates/list.tmpl index e442864..5f8ddea 100644 --- a/nikola/data/themes/base-jinja/templates/list.tmpl +++ b/nikola/data/themes/base-jinja/templates/list.tmpl @@ -1,15 +1,26 @@ {# -*- coding: utf-8 -*- #} {% extends 'base.tmpl' %} +{% import 'archive_navigation_helper.tmpl' as archive_nav with context %} +{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %} + +{% block extra_head %} + {{ feeds_translations.head(kind=kind, rss_override=False, has_no_feeds=has_no_feeds) }} +{% endblock %} {% block content %} <article class="listpage"> <header> - <h1>{{ title }}</h1> + <h1>{{ title|e }}</h1> </header> + {{ archive_nav.archive_navigation() }} + {{ feeds_translations.translation_link(kind) }} {% if items %} <ul class="postlist"> - {% for text, link in items %} - <li><a href="{{ link }}">{{ text }}</a> + {% for text, link, count in items %} + <li><a href="{{ link }}">{{ text|e }}</a> + {% if count %} + ({{ count }}) + {% endif %} {% endfor %} </ul> {% else %} diff --git a/nikola/data/themes/base-jinja/templates/list_post.tmpl b/nikola/data/themes/base-jinja/templates/list_post.tmpl index 919d6f0..e6b2080 100644 --- a/nikola/data/themes/base-jinja/templates/list_post.tmpl +++ b/nikola/data/themes/base-jinja/templates/list_post.tmpl @@ -1,15 +1,23 @@ {# -*- coding: utf-8 -*- #} {% extends 'base.tmpl' %} +{% import 'archive_navigation_helper.tmpl' as archive_nav with context %} +{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %} + +{% block extra_head %} + {{ feeds_translations.head(kind=kind, rss_override=False) }} +{% endblock %} {% block content %} <article class="listpage"> <header> - <h1>{{ title }}</h1> + <h1>{{ title|e }}</h1> </header> + {{ archive_nav.archive_navigation() }} + {{ feeds_translations.translation_link(kind) }} {% if posts %} <ul class="postlist"> {% for post in posts %} - <li><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a> <time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format) }}">{{ post.formatted_date(date_format) }}</time></li> + <li><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time> <a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a></li> {% endfor %} </ul> {% else %} diff --git a/nikola/data/themes/base-jinja/templates/listing.tmpl b/nikola/data/themes/base-jinja/templates/listing.tmpl index ccbc5ba..7b6b3a6 100644 --- a/nikola/data/themes/base-jinja/templates/listing.tmpl +++ b/nikola/data/themes/base-jinja/templates/listing.tmpl @@ -1,23 +1,24 @@ {# -*- coding: utf-8 -*- #} {% extends 'base.tmpl' %} -{% import 'crumbs.tmpl' as ui with context %} +{% import 'ui_helper.tmpl' as ui with context %} {% block content %} -{{ ui.bar(crumbs) }} +{{ ui.breadcrumbs(crumbs) }} {% if folders or files %} <ul> {% for name in folders %} - <li><a href="{{ name }}"><i class="icon-folder-open"></i> {{ name }}</a> + <li><a href="{{ name|e }}" class="listing-folder">{{ name|e }}</a> {% endfor %} {% for name in files %} - <li><a href="{{ name }}.html"><i class="icon-file"></i> {{ name }}</a> + <li><a href="{{ name|e }}.html" class="listing-file">{{ name|e }}</a> {% endfor %} </ul> {% endif %} {% if code %} + <h1>{{ title }} + {% if source_link %} + <small><a href="{{ source_link }}">({{ messages("Source") }})</a></small> + {% endif %} + </h1> {{ code }} {% endif %} -{% if source_link %} - <p class="sourceline"><a href="{{ source_link }}" id="sourcelink">{{ messages("Source") }}</a></p> -{% endif %} {% endblock %} - diff --git a/nikola/data/themes/base-jinja/templates/math_helper.tmpl b/nikola/data/themes/base-jinja/templates/math_helper.tmpl new file mode 100644 index 0000000..c16f9b8 --- /dev/null +++ b/nikola/data/themes/base-jinja/templates/math_helper.tmpl @@ -0,0 +1,69 @@ +{# Note: at present, MathJax and KaTeX do not respect the USE_CDN configuration option #} +{% macro math_scripts() %} + {% if use_katex %} + <script src="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.js" integrity="sha384-9Nhn55MVVN0/4OFx7EE5kpFBPsEMZxKTCnA+4fqDmg12eCTqGi6+BB2LjY8brQxJ" crossorigin="anonymous"></script> + <script src="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"></script> + {% if katex_auto_render %} + <script> + renderMathInElement(document.body, + { + {{ katex_auto_render }} + } + ); + </script> + {% else %} + <script> + renderMathInElement(document.body, + { + delimiters: [ + {left: "$$", right: "$$", display: true}, + {left: "\\[", right: "\\]", display: true}, + {left: "\\begin{equation*}", right: "\\end{equation*}", display: true}, + {left: "\\(", right: "\\)", display: false} + ] + } + ); + </script> + {% endif %} + {% else %} +{# Note: given the size of MathJax; nikola will retrieve MathJax from a CDN regardless of use_cdn configuration #} + <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" integrity="sha384-3lJUsx1TJHt7BA4udB5KPnDrlkO8T6J6v/op7ui0BbCjvZ9WqV4Xm6DTP6kQ/iBH" crossorigin="anonymous"></script> + {% if mathjax_config %} + {{ mathjax_config }} + {% else %} + <script type="text/x-mathjax-config"> + MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}}); + </script> + {% endif %} + {% endif %} +{% endmacro %} + +{% macro math_styles() %} + {% if use_katex %} + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.css" integrity="sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j" crossorigin="anonymous"> + {% endif %} +{% endmacro %} + +{% macro math_scripts_ifpost(post) %} + {% if post.has_math %} + {{ math_scripts() }} + {% endif %} +{% endmacro %} + +{% macro math_scripts_ifposts(posts) %} + {% if posts|selectattr("has_math")|list %} + {{ math_scripts() }} + {% endif %} +{% endmacro %} + +{% macro math_styles_ifpost(post) %} + {% if post.has_math %} + {{ math_styles() }} + {% endif %} +{% endmacro %} + +{% macro math_styles_ifposts(posts) %} + {% if posts|selectattr("has_math")|list %} + {{ math_styles() }} + {% endif %} +{% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/page.tmpl b/nikola/data/themes/base-jinja/templates/page.tmpl new file mode 100644 index 0000000..c2f3f7a --- /dev/null +++ b/nikola/data/themes/base-jinja/templates/page.tmpl @@ -0,0 +1 @@ +{% extends 'story.tmpl' %} diff --git a/nikola/data/themes/base-jinja/templates/pagination_helper.tmpl b/nikola/data/themes/base-jinja/templates/pagination_helper.tmpl new file mode 100644 index 0000000..73cf699 --- /dev/null +++ b/nikola/data/themes/base-jinja/templates/pagination_helper.tmpl @@ -0,0 +1,16 @@ +{# -*- coding: utf-8 -*- #} +{% macro page_navigation(current_page, page_links, prevlink, nextlink, prev_next_links_reversed, surrounding=5) %} +<div class="page-navigation"> + {% for i, link in enumerate(page_links) %} + {% if (i - current_page)|abs <= surrounding or i == 0 or i == page_links|length - 1 %} + {% if i == current_page %} + <span class="current-page">{{ i+1 }}</span> + {% else %} + <a href="{{ page_links[i] }}">{{ i+1 }}</a> + {% endif %} + {% elif i == current_page - surrounding - 1 or i == current_page + surrounding + 1 %} + <span class="ellipsis">…</span> + {% endif %} + {% endfor %} +</div> +{% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/post.tmpl b/nikola/data/themes/base-jinja/templates/post.tmpl index 28da35e..484a2e0 100644 --- a/nikola/data/themes/base-jinja/templates/post.tmpl +++ b/nikola/data/themes/base-jinja/templates/post.tmpl @@ -2,17 +2,15 @@ {% import 'post_helper.tmpl' as helper with context %} {% import 'post_header.tmpl' as pheader with context %} {% import 'comments_helper.tmpl' as comments with context %} +{% import 'math_helper.tmpl' as math with context %} {% extends 'base.tmpl' %} {% block extra_head %} {{ super() }} {% if post.meta('keywords') %} - <meta name="keywords" content="{{ post.meta('keywords')|e }}"> + <meta name="keywords" content="{{ smartjoin(', ', post.meta('keywords'))|e }}"> {% endif %} - {% if post.description() %} - <meta name="description" content="{{ post.description() }}"> - {% endif %} - <meta name="author" content="{{ post.author() }}"> + <meta name="author" content="{{ post.author()|e }}"> {% if post.prev_post %} <link rel="prev" href="{{ post.prev_post.permalink() }}" title="{{ post.prev_post.title()|e }}" type="text/html"> {% endif %} @@ -25,6 +23,7 @@ {{ helper.open_graph_metadata(post) }} {{ helper.twitter_card_information(post) }} {{ helper.meta_translations(post) }} + {{ math.math_styles_ifpost(post) }} {% endblock %} {% block content %} @@ -45,7 +44,7 @@ {{ comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path) }} </section> {% endif %} - {{ helper.mathjax_script(post) }} + {{ math.math_scripts_ifpost(post) }} </article> {{ comments.comment_link_script() }} {% endblock %} diff --git a/nikola/data/themes/base-jinja/templates/post_header.tmpl b/nikola/data/themes/base-jinja/templates/post_header.tmpl index dc844e3..d3c5d3e 100644 --- a/nikola/data/themes/base-jinja/templates/post_header.tmpl +++ b/nikola/data/themes/base-jinja/templates/post_header.tmpl @@ -23,7 +23,7 @@ {% macro html_sourcelink() %} {% if show_sourcelink %} - <p class="sourceline"><a href="{{ post.source_link() }}" id="sourcelink">{{ messages("Source") }}</a></p> + <p class="sourceline"><a href="{{ post.source_link() }}" class="sourcelink">{{ messages("Source") }}</a></p> {% endif %} {% endmacro %} @@ -31,17 +31,32 @@ <header> {{ html_title() }} <div class="metadata"> - <p class="byline author vcard"><span class="byline-name fn">{{ post.author() }}</span></p> - <p class="dateline"><a href="{{ post.permalink() }}" rel="bookmark"><time class="published dt-published" datetime="{{ post.formatted_date('webiso') }}" itemprop="datePublished" title="{{ post.formatted_date(date_format) }}">{{ post.formatted_date(date_format) }}</time></a></p> + <p class="byline author vcard p-author h-card"><span class="byline-name fn p-name" itemprop="author"> + {% if author_pages_generated and multiple_authors_per_post %} + {% for author in post.authors() %} + <a class="u-url" href="{{ _link('author', author) }}">{{ author|e }}</a> + {% endfor %} + {% elif author_pages_generated %} + <a class="u-url" href="{{ _link('author', post.author()) }}">{{ post.author()|e }}</a> + {% else %} + {{ post.author()|e }} + {% endif %} + </span></p> + <p class="dateline"> + <a href="{{ post.permalink() }}" rel="bookmark"> + <time class="published dt-published" datetime="{{ post.formatted_date('webiso') }}" itemprop="datePublished" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time> + {% if post.updated and post.updated != post.date %} + <span class="updated"> ({{ messages("updated") }} + <time class="updated dt-updated" datetime="{{ post.formatted_updated('webiso') }}" itemprop="dateUpdated" title="{{ post.formatted_updated(date_format)|e }}">{{ post.formatted_updated(date_format)|e }}</time>)</span> + {% endif %} + </a> + </p> {% if not post.meta('nocomments') and site_has_comments %} <p class="commentline">{{ comments.comment_link(post.permalink(), post._base_path) }} {% endif %} {{ html_sourcelink() }} {% if post.meta('link') %} - <p class="linkline"><a href='{{ post.meta('link') }}'>{{ messages("Original site") }}</a></p> - {% endif %} - {% if post.description() %} - <meta name="description" itemprop="description" content="{{ post.description() }}"> + <p class="linkline"><a href="{{ post.meta('link') }}">{{ messages("Original site") }}</a></p> {% endif %} </div> {{ html_translations(post) }} diff --git a/nikola/data/themes/base-jinja/templates/post_helper.tmpl b/nikola/data/themes/base-jinja/templates/post_helper.tmpl index b4826eb..94b3c05 100644 --- a/nikola/data/themes/base-jinja/templates/post_helper.tmpl +++ b/nikola/data/themes/base-jinja/templates/post_helper.tmpl @@ -1,9 +1,10 @@ {# -*- coding: utf-8 -*- #} +{% import 'math_helper.tmpl' as math with context %} {% macro meta_translations(post) %} {% if translations|length > 1 %} {% for langname in translations|sort %} - {% if langname != lang and post.is_translation_available(langname) %} + {% if langname != lang and ((not post.skip_untranslated) or post.is_translation_available(langname)) %} <link rel="alternate" hreflang="{{ langname }}" href="{{ post.permalink(langname) }}"> {% endif %} {% endfor %} @@ -15,7 +16,7 @@ <ul itemprop="keywords" class="tags"> {% for tag in post.tags %} {% if tag not in hidden_tags %} - <li><a class="tag p-category" href="{{ _link('tag', tag) }}" rel="tag">{{ tag }}</a></li> + <li><a class="tag p-category" href="{{ _link('tag', tag) }}" rel="tag">{{ tag|e }}</a></li> {% endif %} {% endfor %} </ul> @@ -40,31 +41,29 @@ {% endmacro %} {% macro open_graph_metadata(post) %} -{% if use_open_graph %} - <meta property="og:site_name" content="{{ blog_title|e }}"> - <meta property="og:title" content="{{ post.title()[:70]|e }}"> - <meta property="og:url" content="{{ abs_link(permalink) }}"> - {% if post.description() %} +<meta property="og:site_name" content="{{ blog_title|e }}"> +<meta property="og:title" content="{{ post.title()[:70]|e }}"> +<meta property="og:url" content="{{ abs_link(permalink) }}"> +{% if post.description() %} <meta property="og:description" content="{{ post.description()[:200]|e }}"> - {% else %} +{% else %} <meta property="og:description" content="{{ post.text(strip_html=True)[:200]|e }}"> - {% endif %} - {% if post.previewimage %} +{% endif %} +{% if post.previewimage %} <meta property="og:image" content="{{ url_replacer(permalink, post.previewimage, lang, 'absolute') }}"> - {% endif %} - <meta property="og:type" content="article"> +{% endif %} +<meta property="og:type" content="article"> {# Will only work with Pintrest and breaks everywhere else who expect a [Facebook] URI. #} {# %if post.author(): #} -{# <meta property="article:author" content="{{ post.author() }}"> #} +{# <meta property="article:author" content="{{ post.author()|e }}"> #} {# %endif #} - {% if post.date.isoformat() %} +{% if post.date.isoformat() %} <meta property="article:published_time" content="{{ post.formatted_date('webiso') }}"> - {% endif %} - {% if post.tags %} - {% for tag in post.tags %} - <meta property="article:tag" content="{{ tag }}"> - {% endfor %} - {% endif %} +{% endif %} +{% if post.tags %} + {% for tag in post.tags %} + <meta property="article:tag" content="{{ tag|e }}"> + {% endfor %} {% endif %} {% endmacro %} @@ -84,10 +83,7 @@ {% endif %} {% endmacro %} +{# This function is deprecated; use math_helper directly. #} {% macro mathjax_script(post) %} - {% if post.is_mathjax %} - <script type="text/x-mathjax-config"> - MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});</script> - <script src="/assets/js/mathjax.js"></script> - {% endif %} + {{ math.math_scripts_ifpost(post) }} {% endmacro %} diff --git a/nikola/data/themes/base-jinja/templates/post_list_directive.tmpl b/nikola/data/themes/base-jinja/templates/post_list_directive.tmpl index 92c1b7d..40cf1ce 100644 --- a/nikola/data/themes/base-jinja/templates/post_list_directive.tmpl +++ b/nikola/data/themes/base-jinja/templates/post_list_directive.tmpl @@ -6,10 +6,10 @@ <ul class="post-list"> {% for post in posts %} <li class="post-list-item"> - {{ post.formatted_date(date_format) }} - - <a href="{{ post.permalink(lang) }}">{{ post.title(lang)|e }}</a> - </li> + {{ post.formatted_date(date_format)|e }} + + <a href="{{ post.permalink(lang) }}">{{ post.title(lang)|e }}</a> + </li> {% endfor %} </ul> {% endif %} diff --git a/nikola/data/themes/base-jinja/templates/slides.tmpl b/nikola/data/themes/base-jinja/templates/slides.tmpl deleted file mode 100644 index 0ae8fe8..0000000 --- a/nikola/data/themes/base-jinja/templates/slides.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -{% block content %} -<div id="{{ carousel_id }}" class="carousel slide"> - <ol class="carousel-indicators"> - {% for i in range(slides_content|length) %} - {% if i == 0 %} - <li data-target="#{{ carousel_id }}" data-slide-to="{{ i }}" class="active"></li> - {% else %} - <li data-target="#{{ carousel_id }}" data-slide-to="{{ i }}"></li> - {% endif %} - {% endfor %} - </ol> - <div class="carousel-inner"> - {% for i, image in enumerate(slides_content) %} - {% if i == 0 %} - <div class="item active"><img src="{{ image }}" alt="" style="margin: 0 auto 0 auto;"></div> - {% else %} - <div class="item"><img src="{{ image }}" alt="" style="margin: 0 auto 0 auto;"></div> - {% endif %} - {% endfor %} - </div> - <a class="left carousel-control" href="#{{ carousel_id }}" data-slide="prev">‹</a> - <a class="right carousel-control" href="#{{ carousel_id }}" data-slide="next">›</a> -</div> -{% endblock %} diff --git a/nikola/data/themes/base-jinja/templates/story.tmpl b/nikola/data/themes/base-jinja/templates/story.tmpl index 11973f1..5c93256 100644 --- a/nikola/data/themes/base-jinja/templates/story.tmpl +++ b/nikola/data/themes/base-jinja/templates/story.tmpl @@ -2,10 +2,11 @@ {% import 'post_helper.tmpl' as helper with context %} {% import 'post_header.tmpl' as pheader with context %} {% import 'comments_helper.tmpl' as comments with context %} +{% import 'math_helper.tmpl' as math with context %} {% extends 'post.tmpl' %} {% block content %} -<article class="storypage" itemscope="itemscope" itemtype="http://schema.org/Article"> +<article class="post-{{ post.meta('type') }} storypage" itemscope="itemscope" itemtype="http://schema.org/Article"> <header> {{ pheader.html_title() }} {{ pheader.html_translations(post) }} @@ -19,6 +20,6 @@ {{ comments.comment_form(post.permalink(absolute=True), post.title(), post.base_path) }} </section> {% endif %} - {{ helper.mathjax_script(post) }} + {{ math.math_scripts_ifpost(post) }} </article> {% endblock %} diff --git a/nikola/data/themes/base-jinja/templates/tag.tmpl b/nikola/data/themes/base-jinja/templates/tag.tmpl index 0928a5f..fd5acbf 100644 --- a/nikola/data/themes/base-jinja/templates/tag.tmpl +++ b/nikola/data/themes/base-jinja/templates/tag.tmpl @@ -1,51 +1,37 @@ {# -*- coding: utf-8 -*- #} {% extends 'list_post.tmpl' %} +{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %} {% block extra_head %} - {{ super() }} - {% if translations|length > 1 and generate_rss %} - {% for language in translations|sort %} - <link rel="alternate" type="application/rss+xml" type="application/rss+xml" title="RSS for {{ kind }} {{ tag }} ({{ language }})" href="{{ _link(kind + "_rss", tag, language) }}"> - {% endfor %} - {% elif generate_rss %} - <link rel="alternate" type="application/rss+xml" type="application/rss+xml" title="RSS for {{ kind }} {{ tag }}" href="{{ _link(kind + "_rss", tag) }}"> - {% endif %} + {{ feeds_translations.head(tag, kind, rss_override=False) }} {% endblock %} - {% block content %} <article class="tagpage"> <header> <h1>{{ title|e }}</h1> {% if description %} - <p>{{ description }}</p> + <p>{{ description }}</p> {% endif %} {% if subcategories %} {{ messages('Subcategories:') }} <ul> {% for name, link in subcategories %} - <li><a href="{{ link }}">{{ name }}</a></li> + <li><a href="{{ link }}">{{ name|e }}</a></li> {% endfor %} </ul> {% endif %} <div class="metadata"> - {% if translations|length > 1 and generate_rss %} - {% for language in translations|sort %} - <p class="feedlink"> - <a href="{{ _link(kind + "_rss", tag, language) }}" hreflang="{{ language }}" type="application/rss+xml">{{ messages('RSS feed', language) }} ({{ language }})</a> - </p> - {% endfor %} - {% elif generate_rss %} - <p class="feedlink"><a href="{{ _link(kind + "_rss", tag) }}" type="application/rss+xml">{{ messages('RSS feed') }}</a></p> - {% endif %} + {{ feeds_translations.feed_link(tag, kind=kind) }} </div> + {{ feeds_translations.translation_link(kind) }} </header> {% if posts %} - <ul class="postlist"> - {% for post in posts %} - <li><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a> <time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format) }}">{{ post.formatted_date(date_format) }}</time></li> - {% endfor %} - </ul> + <ul class="postlist"> + {% for post in posts %} + <li><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time> <a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}<a></li> + {% endfor %} + </ul> {% endif %} </article> {% endblock %} diff --git a/nikola/data/themes/base-jinja/templates/tagindex.tmpl b/nikola/data/themes/base-jinja/templates/tagindex.tmpl index f2d2d7a..8ea6a4b 100644 --- a/nikola/data/themes/base-jinja/templates/tagindex.tmpl +++ b/nikola/data/themes/base-jinja/templates/tagindex.tmpl @@ -1,24 +1,29 @@ {# -*- coding: utf-8 -*- #} {% extends 'index.tmpl' %} +{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %} {% block content_header %} - {% if subcategories %} - {{ messages('Subcategories:') }} - <ul> - {% for name, link in subcategories %} - <li><a href="{{ link }}">{{ name }}</a></li> - {% endfor %} - </ul> - {% endif %} + <header> + <h1>{{ title|e }}</h1> + {% if description %} + <p>{{ description }}</p> + {% endif %} + {% if subcategories %} + {{ messages('Subcategories:') }} + <ul> + {% for name, link in subcategories %} + <li><a href="{{ link }}">{{ name|e }}</a></li> + {% endfor %} + </ul> + {% endif %} + <div class="metadata"> + {{ feeds_translations.feed_link(tag, kind) }} + {{ feeds_translations.translation_link(kind) }} + </div> + </header> {% endblock %} {% block extra_head %} {{ super() }} - {% if translations|length > 1 and generate_atom %} - {% for language in translations|sort %} - <link rel="alternate" type="application/atom+xml" title="Atom for the {{ tag }} section ({{ language }})" href="{{ _link(kind + "_atom", tag, language) }}"> - {% endfor %} - {% elif generate_atom %} - <link rel="alternate" type="application/atom+xml" title="Atom for the {{ tag }} section" href="{{ _link("tag" + "_atom", tag) }}"> - {% endif %} + {{ feeds_translations.head(tag, kind, rss_override=False) }} {% endblock %} diff --git a/nikola/data/themes/base-jinja/templates/tags.tmpl b/nikola/data/themes/base-jinja/templates/tags.tmpl index 4605fc9..931ee71 100644 --- a/nikola/data/themes/base-jinja/templates/tags.tmpl +++ b/nikola/data/themes/base-jinja/templates/tags.tmpl @@ -1,10 +1,18 @@ {# -*- coding: utf-8 -*- #} {% extends 'base.tmpl' %} +{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %} + +{% block extra_head %} + {{ feeds_translations.head(kind=kind, feeds=False) }} +{% endblock %} {% block content %} <article class="tagindex"> <header> - <h1>{{ title }}</h1> + <h1>{{ title|e }}</h1> + <div class="metadata"> + {{ feeds_translations.translation_link(kind) }} + </div> </header> {% if cat_items %} {% if items %} @@ -33,7 +41,7 @@ <ul class="postlist"> {% for text, link in items %} {% if text not in hidden_tags %} - <li><a class="reference listtitle" href="{{ link }}">{{ text }}</a></li> + <li><a class="reference listtitle" href="{{ link }}">{{ text|e }}</a></li> {% endif %} {% endfor %} </ul> diff --git a/nikola/data/themes/base-jinja/templates/crumbs.tmpl b/nikola/data/themes/base-jinja/templates/ui_helper.tmpl index 970d509..9eb5697 100644 --- a/nikola/data/themes/base-jinja/templates/crumbs.tmpl +++ b/nikola/data/themes/base-jinja/templates/ui_helper.tmpl @@ -1,6 +1,5 @@ {# -*- coding: utf-8 -*- #} - -{% macro bar(crumbs) %} +{% macro breadcrumbs(crumbs) %} {% if crumbs %} <nav class="breadcrumbs"> <ul class="breadcrumb"> |
