Skip to content

Instantly share code, notes, and snippets.

@tomtorggler
Created March 31, 2017 15:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomtorggler/45bd5478bc8d3542cb7ddb84e2c8eee7 to your computer and use it in GitHub Desktop.
Save tomtorggler/45bd5478bc8d3542cb7ddb84e2c8eee7 to your computer and use it in GitHub Desktop.
Create JSON objects for all posts on a Jekyll site
---
# 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 %}]}
@FelixSelter
Copy link

Much thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment