resolves #8 add JSON feed

This commit is contained in:
Pat Dryburgh
2018-08-25 11:20:19 -07:00
parent adb77ae60e
commit 332a09415e
6 changed files with 51 additions and 3 deletions

View File

@ -136,6 +136,20 @@ To use the post layout, add the following to your post's [front matter](https://
layout: post
```
### Icons
The [JSON Feed spec](https://jsonfeed.org/version/1) states that feeds should include an icon. To add your icon, add the following line in your site's `_config.yml` file:
```
feed_icon: /assets/images/icon-512.png
```
Then, replace the `/assets/images/icon-512.png` file with your own image.
### Credits
The theme credits that appear at the bottom of each page can be turned off by including the following line in your site's `_config.yml` file:
@ -154,7 +168,7 @@ A [copy of the license](https://github.com/patdryburgh/hitchens/blob/master/asse
## Contributing & Requesting Features
Bug reports, feature requests, and pull requests are welcome on GitHub at https://github.com/patdryburgh/hitchens.
Bug reports, feature requests, and pull requests are welcome on GitHub at [https://github.com/patdryburgh/hitchens](https://github.com/patdryburgh/hitchens).
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@ -166,5 +180,4 @@ The theme is setup just like a normal Jekyll site. To test the theme, run `bundl
## License
The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
The code for this theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

View File

@ -19,6 +19,7 @@ description: >- # this means to ignore newlines until "baseurl:"
An inarguably well-designed Jekyll theme.
baseurl: "/hitchens" # the subpath of your site, e.g. /blog
url: "https://patdryburgh.github.io" # the base hostname & protocol for your site, e.g. http://example.com
icon: /assets/images/icon-512.png
twitter_username: patdryburgh
github_username: patdryburgh

View File

@ -10,6 +10,8 @@
<link rel="stylesheet" href="{{ '/assets/css/main.css' | absolute_url }}?{{ site.time | date: '%s%N' }}">
<link rel="apple-touch-icon" href="{{ site.icon }}">
{%- if jekyll.environment == 'production' and site.google_analytics -%}
{%- include google-analytics.html -%}
{%- endif -%}

BIN
assets/images/icon-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

32
feed.json Normal file
View File

@ -0,0 +1,32 @@
---
layout: null
---
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ site.title | xml_escape }}",
"home_page_url": "{{ site.baseurl | absolute_url }}",
"feed_url": "{{ "/feed/index.json" | absolute_url }}",
"description": {{ site.description | jsonify }},
"icon": "{{ site.icon | absolute_url }}",
"favicon": "{{ "/favicon.ico" | absolute_url }}",
"expired": false,
"items": [
{% for post in site.posts limit: 15 %}
{% unless post.draft %}
{% capture content_text %}{{ post.content | strip_html }}{% endcapture %}
{% capture content_html %}{{ post.content | markdownify }}{% endcapture %}
{
"id": "{{ post.url | absolute_url | sha1 }}",
{% if post.title != "" %}"title": {{ post.title | jsonify }},{% endif %}
"content_text": {{ content_text | jsonify }},
"content_html": {{ content_html | jsonify }},
"url": "{{ post.url | absolute_url}}",
"date_published": "{{ post.date | date_to_xmlschema }}",
"date_modified": "{{ post.date | date_to_xmlschema }}",
"author": {
"name": "{{ post.author }}"
}
{% endunless %}
{% endfor %}
]
}