Skip to main content

Adds a webring to your site from a list of web feeds

Project description

Webring

Build Status

This Pelican plugin adds a webring to your site from a list of web feeds.

It retrieves the latest posts from a list of web feeds and makes them available in templates, effectively creating a partial webring. Posts are sorted from newer to older.

It is inspired by openring, a tool for generating an HTML file to include in your SSG from a template and a list of web feeds.

Installation

This plugin can be installed via:

pip install pelican-webring

Settings

WEBRING_FEED_URLS = []

A list of web feeds in the form of a URL or local file.

WEBRING_MAX_ARTICLES = 3

The maximum number of articles.

WEBRING_ARTICLES_PER_FEED = 1

The maximum number of articles per feed.

WEBRING_SUMMARY_LENGTH = 128

The maximum length of post summaries.

WEBRING_CLEAN_SUMMARY_HTML = True

Whether to clean html tags from post summaries or not.

Example

Let's suppose we have two blogs in our webring and want to show two articles per blog. We would also like to show a quite short summary.

WEBRING_FEED_URLS = [
    'https://justinmayer.com/feeds/all.atom.xml',
    'https://danluu.com/atom.xml'
]
WEBRING_ARTICLES_PER_FEED = 2
WEBRING_MAX_ARTICLES = 4
WEBRING_SUMMARY_LENGTH = 25

Templates

The plugin makes available the resulting web feed articles in the variable webring_articles, which is a list of Article objects whose attributes are:

  • title: The article title.
  • link: The article URL.
  • date: The article date as a Pelican utils.SafeDatetime object, which can be used with Pelican's Jinja filter strftime.
  • summary: The article summary, as provided in the web feed and modified according to this plugin's settings.
  • source_title: The title of the web feed.
  • source_link: A link to the web feed.
  • source_id: An identification field provided in some web feeds.

See the following section for an example on how to iterate the article list.

Example

Imagine we'd like to put our webring in the bottom of the default Pelican template (ie. notmyidea). To simplify, we'll use the existing CSS classes.

Edit the notmyidea/templates/base.html file and make it look like this:

        ...
        <section id="extras" class="body">
        {% if WEBRING_FEED_URLS %}
            <div class="webring">
                <h2>Webring</h2>
                {% for article in webring_articles %}
                <p><a href="{{ article.link }}">{{ article.title }}</a></p>
                <p>{{ article.date|strftime('%d %B %Y') }} - {{ article.summary}}</p>
                {% endfor %}
            </div>
        {% endif %}
        {% if LINKS %}
        ...

If there were no links or social widgets, the result would be like in the image below:

Example of Webring

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.

Project details


Release history Release notifications

Download files

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

Files for pelican-webring, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size pelican_webring-1.0.0-py3-none-any.whl (23.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size pelican-webring-1.0.0.tar.gz (23.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page