Skip to main content

Series is a Pelican plugin that joins multiple posts into a series

Project description

Series: A Plugin for Pelican

Build Status PyPI Version License

Series is a Pelican plugin that joins multiple posts into a series. Globally, it provides a list of all the series, and for each article it provides a list of all articles in the same series and links to the next and previous articles in the series.

Installation

This plugin can be installed via:

python -m pip install pelican-series

Usage

In order to mark reStructuredText-formatted posts as part of a series, use the :series: metadata:

:series:  NAME_OF_THIS_SERIES

Or, for Markdown-formatted content:

Series: NAME_OF_THIS_SERIES

The plugin collects all articles belonging to the same series and provides series-related variables that you can use in your template.

Indexing

By default, articles in a series are ordered by date and then automatically numbered.

If you want to force a given order, specify :series_index: (reST) or series_index: (Markdown) in the article metadata, starting from 1. All articles with this enforced index are put at the beginning of the series and ordered according to the index itself. All the remaining articles come after them, ordered by date.

The plugin provides the following variables to your templates:

  • article.series.name is the name of the series as specified in the article metadata
  • article.series.index is the index of the current article inside the series
  • article.series.all is an ordered list of all articles in the series (including the current one)
  • article.series.all_previous is an ordered list of the articles published before the current one
  • article.series.all_next is an ordered list of the articles published after the current one
  • article.series.previous is the previous article in the series (a shortcut to article.series.all_previous[-1]) or None for the first article
  • article.series.next is the next article in the series (a shortcut to article.series.all_next[0]) or None for the last one

For example:

{% if article.series %}
    <p>This post is part {{ article.series.index }} of the "{{ article.series.name }}" series:</p>
    <ol class="parts">
        {% for part_article in article.series.all %}
            <li {% if part_article == article %}class="active"{% endif %}>
                <a href='{{ SITEURL }}/{{ part_article.url }}'>{{ part_article.title }}</a>
            </li>
        {% endfor %}
    </ol>
{% endif %}

Global Context

The plugin also adds the key series to the global context, which is a dictionary of all series names (as keys) and articles (as values). You can use that to list all the series of articles in your site, for example

{% for series_name, series_articles in series.items() %}
{% set article = series_articles[0] %}
<article class="card">
	<a href="{{ article.url }}" class="image">
		<img src="/images/{{ article.image }}.jpg" alt="{{ article.image }}" />
	</a>
	<div class="card-body">
    	<a href="{{ article.url }}"><h3 class="card-title">{{ series_name }}</h3></a>
     	<ul class="actions">
     		<li><a href="{{ article.url }}" class="button">Start</a></li>
     	</ul>
	</div>
</article>
{% endfor %}

Contributing

Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on existing issues.

To start contributing to this plugin, review the Contributing to Pelican documentation, beginning with the Contributing Code section.

License

This project is licensed under the AGPL 3.0 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pelican-series-2.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

pelican_series-2.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file pelican-series-2.1.0.tar.gz.

File metadata

  • Download URL: pelican-series-2.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.4 Linux/5.4.0-1046-azure

File hashes

Hashes for pelican-series-2.1.0.tar.gz
Algorithm Hash digest
SHA256 07227206f457d82ab66ec817e0af03c95cee893b1ed585abc974761f6f947e46
MD5 8c822536c82dc218f02889c17a134bb5
BLAKE2b-256 7f650bb2dc5851d0c278ba8c5381abf9ba428d30fe6add69b4c5cac1730d67ac

See more details on using hashes here.

File details

Details for the file pelican_series-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: pelican_series-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.4 Linux/5.4.0-1046-azure

File hashes

Hashes for pelican_series-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad959e590556f4af5b3f87a3ab375e7844b63cd415025315910158f4c38f8ff8
MD5 1fb8b00ac799931039f40f05792819a3
BLAKE2b-256 142bfae4a838ae8682d3ef975d52d8bfcb1b7cf2471b6216981505bf013577e1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page