Created
December 16, 2019 22:19
-
-
Save LeonardoCardoso/573b48bae294f47ea9c7dbb05c55f797 to your computer and use it in GitHub Desktop.
Jekyll JSON RSS Feed
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: null | |
permalink: /feed.json | |
--- | |
{ | |
"version": "https://jsonfeed.org/version/1", | |
"title": "{{ site.title }}", | |
"description": "{{ site.description }}", | |
"home_page_url": "{{ '/' | absolute_url }}", | |
"feed_url": "{{ page.url | absolute_url }}", | |
"icon": "{{ "/apple-touch-icon.png" | absolute_url }}", | |
"favicon": "{{ "/favicon-192.png" | absolute_url }}", | |
"expired": false, | |
"author": { | |
"name": "{{ site.author.name }}", | |
"url": "{{ site.url }}" | |
}, | |
"items": [ | |
{% assign posts = site.posts | where_exp: "post", "post.draft != true" %} | |
{% for post in posts limit: 50 %} | |
{% if post.feed == true %} | |
{ | |
"id": "{{ post.permalink | absolute_url }}", | |
"url": "{{ post.permalink | absolute_url }}", | |
"external_url": "{{ post.external_url | default: post.permalink | absolute_url }}", | |
"title": "{{ post.title | smartify | strip_html | normalize_whitespace }}", | |
"content_html": {{ post.content | jsonify }}, | |
{% assign post_image = post.image %} | |
{% if post_image %} | |
{% unless post_image contains "://" %} | |
{% assign post_image = post_image | absolute_url | xml_escape %} | |
{% endunless %} | |
"image": "{{ post_image }}", | |
{% endif %} | |
"date_published": "{{ post.date | date_to_xmlschema }}", | |
"date_modified": "{{ post.update_date | default: post.date | date_to_xmlschema }}", | |
"author": { | |
"name": "{{ post.author.name }}" | |
} | |
} | |
{% unless forloop.last %},{% endunless %} | |
{% endif %} | |
{% endfor %} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment