flex/templates/article.html
Florian Haas 20725c8dc0 Support Series plugin
The Pelican Series plugin (https://github.com/pelican-plugins/series)
is a convenient way for authors to link articles together as multiple
installments of a series.

Add support for the Series plugin to this theme: render articles
belonging to a series with a footer pointing to the preceding and
following articles in the series, using the same styling as "related
posts" links.

This implementation is heavily inspired by the Series plugin in the
Pelican bootstrap3 theme (MIT licensed):
https://github.com/getpelican/pelican-themes/blob/master/pelican-bootstrap3/templates/includes/series.html

Fixes #289.
2021-10-15 21:14:28 +02:00

122 lines
4 KiB
HTML

{% extends "base.html" %}
{% block meta %}
<meta name="author" content="{{ article.author.name }}" />
<meta name="description" content="{{ article.summary|striptags|escape }}" />
<meta name="keywords" content="{{ article.tags|join(', ')|escape }}">
{% if article.translations -%}
<link rel="alternate" href="{{ SITEURL }}/{{ article.url }}" hreflang="{{ article.lang }}" />
{% for a in article.translations %}
<link rel="alternate" href="{{ SITEURL }}/{{ a.url }}" hreflang="{{ a.lang }}" />
{% endfor %}
{% endif %}
{% include "partial/og_article.html" %}
{% endblock %}
{% block title %} &ndash; {{ article.title|striptags|escape }}{% endblock %}
{% block content %}
<article class="single">
<header>
{% if not ARTICLE_HIDE_TRANSLATION %}
{% import 'partial/translations.html' as translations with context %}
{{ translations.translations_for(article) }}
{% endif %}
<h1 id="{{ article.slug }}">{{ article.title }}</h1>
<p>
{{ _('Posted on %(when)s in %(category)s',
when=article.locale_date,
category='<a href="%s/%s">%s</a>'|format(SITEURL, article.category.url, article.category)|safe) }}
{% if PLUGINS and 'post_stats' in PLUGINS %}
&#8226; {{ _('%(minutes)s min read', minutes=article.stats['read_mins']) }}
{% endif %}
</p>
</header>
{% if GOOGLE_ADSENSE and GOOGLE_ADSENSE.ads.article_top %}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle ads-responsive"
data-ad-client="{{ GOOGLE_ADSENSE.ca_id }}"
data-ad-slot="{{ GOOGLE_ADSENSE.ads.article_top }}"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
{% endif %}
<div>
{{ article.content }}
</div>
<div class="tag-cloud">
<p>
{% if article.tags %}
{% for tag in article.tags %}
<a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a>
{% endfor %}
{% endif %}
</p>
</div>
{% if ADD_THIS_ID %}
<div class="center social-share">
<p>{{ _('Like this article? Share it with your friends!') }}</p>
<div class="addthis_native_toolbox"></div>
<div class="addthis_sharing_toolbox"></div>
<div class="addthis_inline_share_toolbox"></div>
</div>
{% endif %}
{% include "partial/neighbors.html" %}
{% if article.related_posts %}
<div class="related-posts">
<h4>{{ _('You might enjoy') }}</h4>
<ul class="related-posts">
{% for related_post in article.related_posts %}
<li><a href="{{ SITEURL }}/{{ related_post.url }}">{{ related_post.title }}</a></li>
{% endfor %}
</ul>
</div>
{% elif ADD_THIS_ID %}
<div class="addthis_relatedposts_inline"></div>
{% endif %}
{% if article.series %}
<div class="related-posts">
{% set text = SERIES_TEXT|default('Part %(index)s of the %(name)s series') %}
<h4>{{ text|format(index=article.series.index, name=article.series.name) }}</h4>
{% if article.series.all_previous %}
<h5>Previous articles</h5>
<ul>
{% for article in article.series.all_previous %}
<li><a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% if article.series.all_next %}
<h5>Next articles</h5>
<ul>
{% for article in article.series.all_next %}
<li><a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endif %}
{% if GOOGLE_ADSENSE and GOOGLE_ADSENSE.ads.article_bottom %}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle ads-responsive"
data-ad-client="{{ GOOGLE_ADSENSE.ca_id }}"
data-ad-slot="{{ GOOGLE_ADSENSE.ads.article_bottom }}"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
{% endif %}
{% include "partial/disqus.html" %}
{% include "partial/isso.html" %}
</article>
{% endblock %}