Created
July 11, 2016 02:03
-
-
Save bialecki/f167848379eb3f42ba5bd37ada864649 to your computer and use it in GitHub Desktop.
Shopify Blog JSON Feed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% layout none %}{% comment %} | |
/* | |
* Shopify JSON Blog Feed | |
* | |
* Copyright (c) 2016 Klaviyo (success@klaviyo.com) | |
* Licensed under the MIT license: | |
* http://www.opensource.org/licenses/mit-license.php | |
* | |
*/ | |
{% endcomment %} | |
{ | |
"feed" : { | |
"id" : "{{ canonical_url }}?view=json-feed", | |
"link" : "{{ canonical_url }}", | |
"title" : "{{ shop.name }} - {{ blog.title }}", | |
{% for article in blog.articles limit:20 %}{% if forloop.first %} | |
"updated" : "{{ article.created_at | date: "%FT%TZ" }}", | |
"author" : { | |
"name" : {{ article.author | json }} | |
} | |
}, | |
"entries" : [{% endif %} | |
{ | |
"id" : "{{ shop.url }}/{{ article.url }}", | |
"published" : "{{ article.created_at | date: "%FT%TZ" }}", | |
"updated" : "{{ article.created_at | date: "%FT%TZ" }}", | |
"link" : "{{ shop.url }}/{{ article.url }}", | |
"title" : {{ article.title | json }}, | |
"author" : { | |
"name" : {{ article.author | json }} | |
}, | |
"media" : { | |
"image" : {% if article.image %}{{ article | img_url: 'medium' | json }}{% else %}""{% endif %} | |
}, | |
"content" : {% assign articleContent = article.content %}{{ articleContent | replace:'"//cdn','"https://cdn' | json }} | |
} | |
{% if forloop.rindex0 > 0 %},{% endif %} | |
{% endfor %} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment