> ## Content Index
> Fetch the complete content index at: https://www.ctrl.blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# Recent Posts plug-in for Nikola
- URL: https://www.ctrl.blog/entry/nikola-recent-posts-plugin/
- Published: 2015-05-19T00:51:00.000Z
- Updated: 2026-08-23T22:14:52.000Z
- Description: My new plugin for generating a JSON file with your most recent posts in Nikola. Useful for displaying “recent posts” in the static-site generator.
- Author: Daniel Aleksandersen
- Tags: Nikola

My new plug-in for Nikola gives you the most [recent posts as a JSON file](https://plugins.getnikola.com/v7/recent%5Fposts%5Fjson/?ref=ctrl.blog). This file isn’t very useful on its own, but with client-side scripting you can use it to promote your newest articles and increase your readership.

Unlike all my [earlier Nikola plug-ins](https://www.ctrl.blog/tag/nikola/), this one requires some work on the theme and some client-scripting to be useful.

Install the plug-in by running `nikola plugin -i recent_posts_json`. No configuration in Nikola is required but some options are available. Please refer to the [documentation](https://plugins.getnikola.com/v7/recent%5Fposts%5Fjson/?ref=ctrl.blog "Recent Posts JSON plug-in for Nikola"). Requires Nikola version 7.4 or later.

I’ve gone for a headline list presentation with plenty of spacing between each headline. This is built from the JSON output of this plug-in and some client-side scripting. (Demo at the bottom of the page.) I’ve made an [**annotated version of the client-script**](https://www.daniel.priv.no/blobs/nikola/recent-posts-from-json-plugin.js.html?ref=ctrl.blog) that can kickstart your use of this plug-in.

You will need to tweak some CSS class names (top of the script file) to match your Nikola theme. Check it out as its chock-full of tips specific to the use of this plug-in. Save your script in your files/assets/ directory, and include `BODY_END = "<script async src="/assets/your-script.js"></script>"` in Nikola’s conf.py.

You can customize the JSON file and your script to include meta descriptions/ingresses (set the option RECENT\_POSTS\_JSON\_DESCRIPTION = True) and meta preview images/lead image (set the option RECENT\_POSTS\_JSON\_PREVIEWIMAGE = True.) For example, you could do a typical headline-on-lead-image-carousel on your front page or sidebar.

If you want the same data in XML or for specific tags, categories, or archives, check out Nikola’s new [Atom capabilities](https://www.ctrl.blog/entry/nikola-atom-feeds/).

Alternatively, you can produce the same result without the need for client-side scripting by modifying your theme. You’ll have to rebuild every post every time you make a new post with this approach. That can be very time-consuming and will remove many of the advantages of using a static site builder such as Nikola. Yikes.

Performance tip: Set a decent caching time HTTP header for the script (months?) and a time reflecting how often you post on the JSON file (days? – at least a few hours.)

Bonus stat: Both the page-view count per visitor and advertisement click-through rates (CTR) increases after implementing this list at the bottom of each post here on this site.