1

Add json-feed support

This commit is contained in:
Evan Pratten 2020-09-09 11:02:09 -04:00
parent 6d51f2696e
commit 8bffb37581
No known key found for this signature in database
GPG Key ID: 93AC7B3D071356D3
2 changed files with 28 additions and 0 deletions

View File

@ -6,6 +6,10 @@
{%seo%}
<!-- Discovery -->
<link rel="alternate" title="{{site.title}}" type="application/rss+xml" href="{{site.url}}/feed.xml" />
<link rel="alternate" title="{{site.title}}" type="application/json" href="{{site.url}}/feed.json" />
<!-- Bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

24
feed.json Normal file
View File

@ -0,0 +1,24 @@
---
---
{
"version": "https://jsonfeed.org/version/1",
"title": "{{site.title}}",
"home_page_url": "{{site.url}}",
"feed_url": "{{site.url}}/feed.json",
"items": [
{% assign i = site.posts | size %}
{% for post in site.posts %}
{
"id":{{i}},
"content_html":"{{post.excerpt | replace: '"', "'" | strip | strip_newlines}}",
"url":"{{site.url}}{{post.url}}"
},
{% assign i = i | minus:1 %}
{% endfor %}
{
"id":0,
"content_text":"",
"url":"{{site.url}}"
}
]
}