Skip to main content

Blog aggregator plugin for Pelican

Project description

Blog aggregation, static-website style!

Coverage Status

This is a plugin for the Pelican static site generator.

It allows generating a page aggregating blog articles from other web sites.

Usage

Install this plugin:

$ pip install pelican-feed-planet

Then, in your Pelican config file, enable the plugin:

PLUGINS = [
    ...
    'pelican_planet',
    ...
    ]

Next, declare the feeds you want to aggregate in your Pelican config file:

PLANET_FEEDS = {
    'Some amazing blog': 'https://example1.org/feeds/blog.atom.xml',
    'Another great blog': 'http://example2.org/feeds/blog.atom.xml',
    }

Write a Jinja2 template for your aggregation page. For example, if the rest of your website is generated from Markdown pages, then create a planet.md.tmpl file with the following contents:

Some blogs aggregated here.

{% for article in articles %}
# {{ article.title }}

{% endfor %}

Finally, declare the template and destination page in your Pelican config file:

PLANET_TEMPLATE = 'planet.md.tmpl'
PLANET_PAGE = 'content/planet.md'

Then rebuild your website as usual using the pelican command line, and you should have your blog aggregation page.

You'll probably want to rebuild your website periodically though, maybe with a systemd timer or a cron job, to always fetch the latest articles in the feeds you aggregate.

Template design

The template for your aggregation page will be passed an articles variable, containing the list of articles aggregated.

Each item of this list will have the following attributes:

  • title: The title of the article;
  • updated: The date at which the article was last updated, as a timezone-aware datetime object;
  • author: The author of the article;
  • link: The URL to the article on its original website;
  • summary: The summary text of the article;
  • feed_name: The name of the feed from which the article originated, as defined in the Pelican config file;

Optional configuration

You can have more control on the generated page, by setting a few more options in your Pelican config file:

  • PLANET_MAX_ARTICLES: The maximum number of articles to show on the page.

    By default, all articles from all feeds will be added to the page.

  • PLANET_MAX_ARTICLES_PER_FEED: The maximum of articles from a single feed ending on the page.

    By default all articles of a given feed are considered.

  • PLANET_MAX_SUMMARY_LENGTH: The maximum number of words kept from the summary.

    By default the summary of the article will be the full text coming from the feed.

Legalities

pelican-planet is offered under the terms of the GNU Affero General Public License, either version 3 or any later version.

We will never ask you to sign a copyright assignment or any other kind of silly and tedious legal document before accepting your contributions.

In case you're wondering, we do not consider that a website built with pelican-planet would need to be licensed under the AGPL.

Release History

0.9.1

This is a trivial release, fixing some release-related issues:

  • Moved to reStructuredText for the README/CHANGES files, as that's what Pypi prefers;
  • Fixed the link to the AGPLv3+ license;
  • Added a missing Pypi classifier;
  • Added missing files to the dist tarball;

0.9

Initial release:

  • Aggregates a list of feeds into a page generated by a template;
  • Optionally limits the total number of articles kept, as well as the number of articles per feed;
  • Displays the full articles, or just short summaries;
  • Supports Python 3.4 and up;

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_feed_planet-0.25.0.tar.gz (18.5 kB view details)

Uploaded Source

File details

Details for the file pelican_feed_planet-0.25.0.tar.gz.

File metadata

  • Download URL: pelican_feed_planet-0.25.0.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pelican_feed_planet-0.25.0.tar.gz
Algorithm Hash digest
SHA256 97f95f8a905b536158a5119c8d3b52d49db9652950d8d583af5edb01bd562089
MD5 de6fc019e967ac211fb713859a1e7783
BLAKE2b-256 2ee9472e9effd59e8bf961d9a23ca4b6f50b417dc1c7b76b33330a4edb83ff66

See more details on using hashes here.

Provenance

The following attestation bundles were made for pelican_feed_planet-0.25.0.tar.gz:

Publisher: publish.yml on macbre/pelican-feed-planet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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