Created
March 31, 2017 15:56
-
-
Save tomtorggler/45bd5478bc8d3542cb7ddb84e2c8eee7 to your computer and use it in GitHub Desktop.
Create JSON objects for all posts on a Jekyll site
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
--- | |
# Requires Front Matter | |
--- | |
{"items":[{% for post in site.posts %}{ | |
"title": {{post.title | jsonify}}, | |
"url": {{ post.url | prepend: site.baseurl | prepend: site.url | jsonify }}, | |
"date": {{ post.date | date: '%B %-d, %Y' | jsonify }}, | |
"category": {{ post.category | jsonify }}, | |
"tags": {{ post.tags | jsonify }}, | |
"author": {{ post.author | jsonify }}, | |
"content": {{ post.content | strip_html | strip_newlines | jsonify }} | |
}{% unless forloop.last %},{% endunless %}{% endfor %}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Much thanks!