Skip to content

Commit

Permalink
json feed
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfmiller committed May 20, 2017
1 parent 48f3886 commit b57a7ca
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 7 deletions.
3 changes: 1 addition & 2 deletions blog/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
# in the templates via {{ site.myvariable }}.
title: READMEANSBLOG
email: davidfmiller@me.com
description: > # this means to ignore newlines until "baseurl:"
READMEANSBLOG
description: ... is a blog about nerdy things by READMEANSRUN
baseurl: "/blog" # the subpath of your site, e.g. /blog
url: "https://readmeansrun.com" # the base hostname & protocol for your site, e.g. http://example.com
twitter_username: readmeansrun
Expand Down
2 changes: 1 addition & 1 deletion blog/_includes/footer.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<footer>
<hr>
<a href="{{ "/feed.xml" | relative_url }}" title="Subscribe to READMEANSBLOG’s feed">Subscribe</a>
Subscribe in <a href="{{ "/feed.json" | relative_url }}" title="JSON Feed">JSON</a> or <a href="{{ "/feed.xml" | relative_url }}" title="Atom">XML</a>
</footer>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
Expand Down
5 changes: 1 addition & 4 deletions blog/_includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@

<link rel="stylesheet" href="{{ "/assets/main.css" | relative_url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title | escape }}" href="{{ "/feed.xml" | relative_url }}">

{% if jekyll.environment == 'production' and site.google_analytics %}
{% include google-analytics.html %}
{% endif %}
<link rel="alternate" title="{{ site.title | escape }}" type="application/json" href="{{ "/feed.json" | relative_url }}" />
</head>
30 changes: 30 additions & 0 deletions blog/_layouts/jsonfeed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
layout: none
---
{
"version": "https://jsonfeed.org/version/1",
"title": {{ site.title | jsonify }},
"description": {{ site.description | jsonify }},
"home_page_url": "{{ site.url }}/",
"feed_url": "{{ site.url }}/feed.json",
"icon": "{{ site.url }}/apple-touch-icon.png",
{% comment %}"favicon": "",{% endcomment %}
"expired": false,
"items": [
{% for post in site.posts %}
{
"id": "{{ post.id }}",
"title": {{ post.title | jsonify }},
{% comment %}"content_html": {{ post.content | jsonify }},{% endcomment %}
"url": "{{ site.url }}{{ site.baseurl }}{{ post.url }}",
{% if post.excerpt %}
"summary": {{ post.excerpt | jsonify }},
{% else %}
"summary": {{ t.frontpage[page_language].description | jsonify }},
{% endif %}
"date_published": "{{ post.date }}"
{% comment %}"author": ""{% endcomment %}
}{% unless forloop.last == true %},{% endunless %}
{% endfor %}
]
}
4 changes: 4 additions & 0 deletions blog/feed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
layout: jsonfeed
lang: en
---

0 comments on commit b57a7ca

Please sign in to comment.