thanethomson / statik

Multi-purpose static web site generator aimed at developers.
https://getstatik.com
MIT License
257 stars 30 forks source link

Batteries-included RSS/Atom feed support #23

Open thanethomson opened 8 years ago

thanethomson commented 8 years ago

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())
konstruktiv commented 6 years ago

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?

thanethomson commented 6 years ago

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.