GithubHelp home page GithubHelp logo

lektor-feed's Introduction

Lektor Feed Plugin

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

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

Atom and RSS feed plugin for Lektor. This plugin is based on lektor-atom, but enhances it in several ways.

  • Support for generating RSS feeds too (planned)
  • Same IDs even if generated on different computers

Installation

Add lektor-feed to your project from command line:

lektor plugins add lektor-feed

See the Lektor documentation for more instructions on installing plugins.

Configuration

For each feed you want to publish, add a section to configs/feed.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 Feed name: default is section name
filename feed.xml Name of generated feed file
url_path Feed's URL on your site: default is source's URL path plus the filename
blog_author_field author Name of source's author field
blog_summary_field summary Name of source's summary field
items None A query expression: default is the source's children
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 Name of items' model

Customizing the plugin for your models

Use the field options to tell lektor-feed 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 feed.ini:

[main]
blog_author_field = writer
blog_summary_field = short_description

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

Filtering items

By default, lektor-feed gets the source at source_path and includes all its children in the feed. If you set item_model, lektor-feed 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-feed applies it as a filter to items.

lektor-feed's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.