Adds a webring to your site from a list of web feeds
Project description
Webring
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 Pelicanutils.SafeDatetime
object, which can be used with Pelican's Jinja filterstrftime
.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:
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pelican_webring-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a585137ce7420e0dfe295e56d5c9397a60fd804f99d816c8ad92aa88ab7fa3f9 |
|
MD5 | 23a103f236e021db12de9b7aee26dff2 |
|
BLAKE2b-256 | 97af04159f52d1ce2ca85eeec8f6a03344f13e2a89a5735119e9643ac459de86 |