1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-22 18:00:06 +01:00

add json feed

This commit is contained in:
Matthias Kretschmann 2017-05-28 22:06:41 +02:00
parent d7e97d16c7
commit e681b6e689
Signed by: m
GPG Key ID: BD3C1F3EDD7831FC
6 changed files with 48 additions and 2 deletions

View File

@ -37,7 +37,7 @@ Get up and running
Run the following command from the repository's root folder to install all dependencies.
```bash
npm install && bower install && bundle install
npm install && bundle install
```
### Development server

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="18" viewBox="0 0 19 18">
<path d="M1.30841121,11.0316983 C0.577754036,10.9880199 -9.23705556e-14,10.4359251 -9.23705556e-14,9.76127321 C-9.23705556e-14,9.08662131 0.577754036,8.53452653 1.30841121,8.49084813 L1.30841121,8.48060345 C2.83896758,8.48060345 3.34915304,7.90948276 3.34915304,6.21767241 L3.34915304,3.90086207 C3.34915304,1.18534483 4.84411507,0 8.27303592,0 L9.31713639,0 L9.31713639,2.00431034 L8.78322138,2.00431034 C6.825533,2.00431034 6.16110543,2.59698276 6.16110543,4.31034483 L6.16110543,7.12284483 C6.16110543,8.68534483 5.41362442,9.49353448 3.81187938,9.63362069 L3.81187938,9.93534483 C5.3661653,10.0646552 6.16110543,10.9482759 6.16110543,12.5646552 L6.16110543,15.700431 C6.16110543,17.3814655 6.84926256,17.9849138 8.78322138,17.9849138 L9.31713639,17.9849138 L9.31713639,20 L8.27303592,20 C4.85597985,20 3.34915304,18.7715517 3.34915304,15.9913793 L3.34915304,13.3189655 C3.34915304,11.6271552 2.85083236,11.0668103 1.30841121,11.0668103 L1.30841121,11.0316983 Z M9.25233645,11.0344828 C8.47810549,11.0344828 7.85046729,10.4644474 7.85046729,9.76127321 C7.85046729,9.05809899 8.47810549,8.48806366 9.25233645,8.48806366 C10.0265674,8.48806366 10.6542056,9.05809899 10.6542056,9.76127321 C10.6542056,10.4644474 10.0265674,11.0344828 9.25233645,11.0344828 Z M13.9252336,11.0344828 C13.1510027,11.0344828 12.5233645,10.4644474 12.5233645,9.76127321 C12.5233645,9.05809899 13.1510027,8.48806366 13.9252336,8.48806366 C14.6994646,8.48806366 15.3271028,9.05809899 15.3271028,9.76127321 C15.3271028,10.4644474 14.6994646,11.0344828 13.9252336,11.0344828 Z M18.5981308,11.0344828 C17.8238999,11.0344828 17.1962617,10.4644474 17.1962617,9.76127321 C17.1962617,9.05809899 17.8238999,8.48806366 18.5981308,8.48806366 C19.3723618,8.48806366 20,9.05809899 20,9.76127321 C20,10.4644474 19.3723618,11.0344828 18.5981308,11.0344828 Z" transform="rotate(-45 7.747 7.452)"/>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -67,6 +67,8 @@
.rss:hover .icon
fill: #e15a00
.json:hover .icon
fill: #8BE028
.twitter:hover .icon
fill: #019ad2
.google:hover .icon

View File

@ -11,11 +11,16 @@
<aside class="subscribe">
<h1 class="subscribe-title">Subscribe</h1>
<p>
<a class="link rss" href="http://kremalicious.com/feed">
<a class="link rss" href="http://kremalicious.com/feed" title="RSS Feed">
<svg class="icon icon-rss">
<use xlink:href="/assets/img/sprite.svg#rss"></use>
</svg>
</a>
<a class="link json" href="http://kremalicious.com/feed.json" title="JSON Feed">
<svg class="icon icon-jsonfeed">
<use xlink:href="/assets/img/sprite.svg#jsonfeed"></use>
</svg>
</a>
<a class="link twitter" href="https://twitter.com/kremaliciouscom">
<svg class="icon icon-twitter">
<use xlink:href="/assets/img/sprite.svg#twitter"></use>

View File

@ -87,6 +87,8 @@
<!-- Atom feed -->
<link href="{{ site.url }}/feed.xml" rel="alternate" type="application/atom+xml" title="{{ site.name }} posts feed" />
<!-- json feed -->
<link href="{{ site.url }}/feed.json" rel="alternate" type="application/json" title="{{ site.name }} posts feed" />
<!-- Apple -->
<meta name="apple-mobile-web-app-title" content="kremalicious">

34
_src/feed.json Normal file
View File

@ -0,0 +1,34 @@
---
layout: null
---
{
"version": "https://jsonfeed.org/version/1",
"title": {{ site.name | smartify | jsonify }},
{% if site.description %}"description": {{ site.description | smartify | jsonify }},{% endif %}
"home_page_url": "{{ site.url }}",
"feed_url": "{{ site.url }}/feed.json",
"icon": "{{ site.url }}/assets/img/touch-icon-192x192.png",
"favicon": "{{ site.url }}/assets/img/favicon-32x32.png",
"expired": false,
"author": {
"name": {{ site.author.name | smartify | jsonify }},
"url": "{{ site.author.uri }}",
"avatar": "https://kremalicious.com/assets/img/avatar.jpeg"
},
"items": [
{% for post in site.posts %}
{
"title": {{ post.title | smartify | jsonify }},
"date_published": "{{ post.date }}",
{% if post.updated %}"date_modified": "{{ post.updated }}",{% endif %}
"id": "{{ post.id }}",
"url": "{{ site.url }}{{ post.url }}",
{% if post.linkurl %}"external_url": "{{ post.linkurl }}",{% endif %}
"author": "{{ site.author.name }}",
"summary": {{ post.excerpt | smartify | jsonify }},
{% if post.image %}"image": "{{ site.url }}/media/{{ post.image }}",{% endif %}
"content_html": {{ post.content | jsonify }}
}{% unless forloop.last == true %},{% endunless %}
{% endfor %}
]
}