Last active
December 24, 2018 22:00
-
-
Save JadedBlueEyes/0b2c52cd38e9333b80cade9f7b1f6a74 to your computer and use it in GitHub Desktop.
A pure liquid JSONFeed for Jekyll.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
layout: none | |
--- | |
{ | |
"version": "https://jsonfeed.org/version/1", | |
"title": {{ site.title | jsonify }}, | |
"description": {{ site.description | jsonify }}, | |
"home_page_url": "{{ '/' | absolute_url }}", | |
"feed_url": "{{ '/feed.json' | absolute_url }}", | |
"favicon": "{{ '/favicon-32x32.png' | absolute_url }}", | |
{% if site.author %} | |
"author": { | |
"name": {{ site.author.name | default: site.author | json }}, | |
{% if site.author.uri %} | |
"url": {{ site.author.uri | json }} | |
{% endif %} | |
}, | |
{% endif %} | |
"items": [ | |
{% assign posts = site.posts | where_exp: "post", "post.draft != true" %} | |
{% for post in posts limit: 10 %} | |
{ | |
"id": "{{ post.url | absolute_url }}", | |
"url": "{{ post.url | absolute_url }}", | |
"title": {{ post.title | smartify | strip_html | normalize_whitespace | jsonify}}, | |
"summary": {{ post.excerpt | smartify | normalize_whitespace | jsonify }}, | |
"content_html": {{ post.content | markdownify | jsonify }}, | |
"date_published": "{{ post.date | date_to_rfc822 }}" | |
}{% unless forloop.last %},{% endunless %} | |
{% endfor %} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adding this to your site is simple. Just paste the contents of this gist into a file called
feed.json
, then provide a link that your users can put into their feed reader in the same place that your RSS feed is linked, or in the footer.