Move series and related_posts plugins to a partial
This commit is contained in:
parent
513ceccdf2
commit
50ce2b5fda
3 changed files with 57 additions and 33 deletions
|
@ -68,42 +68,14 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% include "partial/series.html" %}
|
||||||
|
|
||||||
{% include "partial/neighbors.html" %}
|
{% include "partial/neighbors.html" %}
|
||||||
|
|
||||||
{% if article.related_posts %}
|
{% include "partial/related_posts.html" %}
|
||||||
<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 %}
|
{% if ADD_THIS_ID %}
|
||||||
<div class="related-posts">
|
<div class="addthis_relatedposts_inline"></div>
|
||||||
{% 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 %}
|
{% endif %}
|
||||||
|
|
||||||
{% if GOOGLE_ADSENSE and GOOGLE_ADSENSE.ads.article_bottom %}
|
{% if GOOGLE_ADSENSE and GOOGLE_ADSENSE.ads.article_bottom %}
|
||||||
|
@ -117,6 +89,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% include "partial/disqus.html" %}
|
{% include "partial/disqus.html" %}
|
||||||
|
|
||||||
{% include "partial/isso.html" %}
|
{% include "partial/isso.html" %}
|
||||||
</article>
|
</article>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
14
templates/partial/related_posts.html
Normal file
14
templates/partial/related_posts.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{% if 'pelican.plugins.related_posts' in PLUGINS %}
|
||||||
|
{% if article.related_posts %}
|
||||||
|
<div class="related-posts">
|
||||||
|
<h5>{{ _('You might enjoy') }}</h5>
|
||||||
|
<ul>
|
||||||
|
{% for related_post in article.related_posts %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ SITEURL }}/{{ related_post.url }}">{{ related_post.title }}</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
37
templates/partial/series.html
Normal file
37
templates/partial/series.html
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{% if 'pelican.plugins.series' in PLUGINS %}
|
||||||
|
{% if article.series %}
|
||||||
|
<div class="related-posts">
|
||||||
|
<h4>{{ _('Part %(index)s of the "%(name)s" series', index=article.series.index, name=article.series.name) }}</h4>
|
||||||
|
|
||||||
|
{% if article.series.all_previous %}
|
||||||
|
{% if article.series.all_previous|length > 1 %}
|
||||||
|
<h5>{{ _('Previous articles') }}</h5>
|
||||||
|
{% else %}
|
||||||
|
<h5>{{ _('Previous article') }}</h5>
|
||||||
|
{% endif %}
|
||||||
|
<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 %}
|
||||||
|
{% if article.series.all_next|length > 1 %}
|
||||||
|
<h5>{{ _('Next articles') }}</h5>
|
||||||
|
{% else %}
|
||||||
|
<h5>{{ _('Next article') }}</h5>
|
||||||
|
{% endif %}
|
||||||
|
<ul>
|
||||||
|
{% for article in article.series.all_next %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
Loading…
Reference in a new issue