Skip to main content

Lektor plugin that generates Atom feeds.

Project description

Lektor Atom Plugin

Linux tests Code Style: Black Join the chat at https://gitter.im/lektor/lektor

Builds one or more Atom XML feeds for your Lektor-based site.

Inspired by the atom-feed-support plugin Armin Ronacher wrote for the Lektor official blog.

Installation

Add lektor-atom to your project from command line:

lektor plugins add lektor-atom

See the Lektor documentation for more instructions on installing plugins.

Configuration

Here is a basic configuration:

[feed]
name = My Site's Blog
source_path = /blog
url_path = /feed.xml

For each feed you want to publish, add a section to configs/atom.ini. For example, a blog with a feed of all recent posts, and a feed of recent posts about coffee:

[blog]
name = My Blog
source_path = /
url_path = /feed.xml
items = site.query('/').filter(F.type == 'post')
item_model = blog-post

[coffee]
name = My Blog: Articles About Coffee
source_path = /
url_path = /category/coffee/feed.xml
items = site.query('/blog').filter(F.categories.contains('coffee'))
item_model = blog-post

The section names, like blog and coffee, are just used as internal identifiers.

Options

Option Default Description
source_path / Where in the content directory to find items' parent source
name config section name Feed name
filename feed.xml Name of generated Atom feed file
url_path source_path + filename Feed's URL on your site
blog_author_field author Name of source's author field
blog_summary_field summary Name of source's summary field
items source_path's children A query expression: e.g. site.query('/').filter(F.type == 'post')
limit 50 How many recent items to include
item_title_field title Name of items' title field
item_body_field body Name of items' content body field
item_author_field author Name of items' author field
item_date_field pub_date Name of items' publication date field
item_model None Filters items on name of items' model

Customizing the plugin for your models

Use the field options to tell lektor-atom how to read your items. For example, if your site's model is:

[model]
name = Blog

[fields.writer]
type = string

[fields.short_description]
type = string

Then add to atom.ini:

[main]
blog_author_field = writer
blog_summary_field = short_description

See tests/demo-project/configs/atom.ini for a complete example.

Filtering items

By default, lektor-atom gets the source at source_path and includes all its children in the feed. If you set item_model, lektor-atom includes only the children with that data model.

Set items to any query expression to override the default. If items_model is also specified, lektor-atom applies it as a filter to items.

Use In Templates

You can link to a specific feed in your template. If your atom.ini contains a feed like this:

[main]
source_path = /blog

Link to the feed in a template like this:

{{ '/blog@atom/main'|url }}

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

lektor-atom-0.4.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

lektor_atom-0.4.0-py2.py3-none-any.whl (5.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file lektor-atom-0.4.0.tar.gz.

File metadata

  • Download URL: lektor-atom-0.4.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for lektor-atom-0.4.0.tar.gz
Algorithm Hash digest
SHA256 70f4e018278d68d07d48dc9b748cd012f1f558bef04d984c45d9a36e5a880176
MD5 420a3dbf0c6d90e9c3eeaf6a7a148eff
BLAKE2b-256 76472aa4b997009ee651081aa42ee34d67ee0cee876eddba1da7488f94c63779

See more details on using hashes here.

Provenance

File details

Details for the file lektor_atom-0.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: lektor_atom-0.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for lektor_atom-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0299ea8dcac0f2535e74e273cf939a8052f22dd9e99831b056a8cde9a8318563
MD5 938f0e351ed32d57186b1b9571b86e39
BLAKE2b-256 f0f5176cf3798e2dec47344372d8624a0e02267ae5ea78d4fa70e1751ebe28d3

See more details on using hashes here.

Provenance

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