Generate JSON with recent posts.

To install, run nikola plugin -i recent_posts_json

This plug-in generates a /index.json file containing the same posts as /index.html. Intended to be used in JavaScripts. For example to promote the most recent posts at the bottom of older posts.

By default, the JSON file will include: [ { "date": , "title": , "loc": }, ]

Optionally, it can be expanded to include thumbnails or descriptions: [ { "date" , "title": , "loc": , "desc": , "img": ], }

Posts are sorted by their as JavaScript dates.

JSON files will also be created for any sections.

Pro tip: Set a sensible cache header for the JSON file.

Suggested Configuration:

# Generates a /index.json with the most recent posts from /index.html.
# Will also create /$section/index.json for each section.
# Can be expanded with these options:

# Number of posts to include, defaults to INDEX_DISPLAY_POST_COUNT (10)

# Include {"desc": post.description}, defaults to False

# Include {"img": post.meta.previewimage}, defaults to False

Issues? Questions?

You can report issues with this plugin and request help via GitHub Issues.