Your Own Gravity Your Own Gravity     Categories     About     Feed    


I updated this blog to support JSON Feed, by Manton Reece and Brent Simmons.

You can find the new feed here.

If I had done this from scratch, it probably would have taken about an hour, including a quick test and deployment. Since I’m using Jekyll, I found a good example from Hafnia Times on github and shamelessly copied and customized it.

I created feedjson.html in the _layouts folder:

layout: none

    "version": "",
    "title": {{ | smartify | jsonify }},
    {% if site.description %}"description": {{ site.description | smartify | jsonify }},{% endif %}
    "home_page_url": "{{ site.url }}/",
    "feed_url": "{{ site.url }}{{ site.feed_json }}",
    "expired": false,
    "items": [
{% for post in site.posts %}
            "id": "{{ }}",
            "title": {{ post.title | smartify | jsonify }},
            "content_html": {{ post.content | jsonify }},
            "url": "{{ site.url }}{{ post.url }}",
        {% if post.excerpt %}
            "summary": {{ post.excerpt | smartify | jsonify }},
        {% else %}
            "summary": {{ t.frontpage[page_language].description | smartify | jsonify }},
        {% endif %}
            "date_published": "{{ }}"
        }{% unless forloop.last == true %},{% endunless %}
{% endfor %}

Then I created a feeds folder and put this feed.json file there:

layout: feedjson

The whole thing took about ten minutes.

I like JSON Feed for the reasons outlined here. It’s easier to create and consume than an XML feed like RSS or Atom. This is especially true if you’re embedding HTML within the feed. Doing this in XML is pain. In fact, XML in general is a pain. JSON Feed is a long-overdue evolution of blog feeds.

Where does this go from here? Don’t know yet.

Update: In addition to the Hafnia Times project mentioned above, here are some other implementations of JSON Feed for Jekyll (I have only looked at these briefly):

Categories    Technology    Meta