JSON feed
The JSON feed format is a syndication format, like RSS and Atom, but it’s JSON instead of XML.
To expose a JSON feed on your site:
- Add a new view to your template. Warning: If you have an existing view called feed.rss or feed.xml, please name your JSON feed something other than feed.json. Two template views cannot share the same name, even if they have different extensions.
- Paste in the following code:
{ "version": "https://jsonfeed.org/version/1", "title": "{{#encode_json}}{{{title}}}{{/encode_json}}", "description": "{{#encode_json}}Feed for {{{title}}}{{/encode_json}}", "home_page_url": "{{{siteURL}}}", "feed_url": "{{{siteURL}}}/jsonfeed.json", "items": [ {{#recent_entries}} { "id": "{{{absoluteURL}}}", "title": "{{#encode_json}}{{{title}}}{{/encode_json}}", {{#summary}} "summary": "{{#encode_json}}{{{summary}}}{{/encode_json}}", {{/summary}} {{#thumbnail.large}} "image": "{{{siteURL}}}{{{url}}}", {{/thumbnail.large}} "content_html": "{{#encode_json}}{{#absolute_urls}}{{{body}}}{{/absolute_urls}}{{/encode_json}}", "date_published": "{{#formatDate}}YYYY-MM-DDTHH:mm:ssZ{{/formatDate}}", "url": "{{{absoluteURL}}}" }{{^last}},{{/last}} {{/recent_entries}} ] }
You can verify your feed is correctly formed using the JSON feed validator.
Thanks to Amit Gawande and Jamie Thingelstad for their help with this guide. And thanks to Manton Reece and Brent Simmons for writing the JSON feed spec.