From 8bffb3758135e498795c5f088da3da05705ad1d1 Mon Sep 17 00:00:00 2001
From: Evan Pratten <ewpratten@gmail.com>
Date: Wed, 9 Sep 2020 11:02:09 -0400
Subject: [PATCH] Add json-feed support

---
 _includes/head.html |  4 ++++
 feed.json           | 24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 feed.json

diff --git a/_includes/head.html b/_includes/head.html
index 42e9a50..edb5a14 100644
--- a/_includes/head.html
+++ b/_includes/head.html
@@ -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">
diff --git a/feed.json b/feed.json
new file mode 100644
index 0000000..862e9b1
--- /dev/null
+++ b/feed.json
@@ -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}}"
+        }
+    ]
+}
\ No newline at end of file