Last month, Brent Simmons and Manton Reece announced the specification for JSON Feed. I decided it was time to get Drinking Caffeine on board with the new spec. I started with Niclas Darville’s version and then modified it as needed. I created a file named feed.json in the root directory of my Jekyll site and then pasted this into it:

---
layout: null
permalink: feed.json
---
{
    "version": "https://jsonfeed.org/version/1",
    "title": "{{ site.title }}",
    "home_page_url": "{{ site.url }}/",
    "feed_url": "{{ site.url }}/feed.json",
    "author": {
        "name": "{{ site.author }}"
    },
    "items": [
{% for post in site.posts | limit:20 %}
        {
            "id": "{{ site.url }}{{ post.id }}",
            "title": {{ post.title | smartify | jsonify }},
            "content_html": {{ post.content | jsonify }},
            "url": "{{ site.url }}{{ post.url }}",
            {% if post.link %}"external_url": "{{ post.link }}",{% endif %}
            "date_published": "{{ post.date }}"
        }{% unless forloop.last == true %},{% endunless %}
{% endfor %}
    ]
}

You can now view the JSON feed for Drinking Caffeine here.