statik
statik copied to clipboard
Batteries-included RSS/Atom feed support
RSS/Atom feeds should be generated automatically from configuration options in the project's config.yml file.
e.g.
project-name: RSS demo project
base-path: /
feeds:
posts:
file: /feeds/posts.xml
query: session.query(Post).order_by(Post.date.desc())
projects:
file: /feeds/projects.xml
query: session.query(Project).order_by(Project.released.desc())
Wouldn't this only create a feed for all posts/projects/etc? How could we get feeds for more specific queries, such as all posts of a certain category or with a certain tag?
That particular example would get all posts and projects, but to make it more specific, just tweak your SQLAlchemy/MLAlchemy query that generates the feed.
e.g.
feeds:
programming-posts:
file: /feeds/programming-posts.xml
query: session.query(Post).filter(Post.tags.any(name='programming')).order_by(Post.date.desc())
See SQLAlchemy's documentation for details.