Skip to content

Instantly share code, notes, and snippets.

@gest01
Created December 25, 2015 12:49
Show Gist options
  • Save gest01/07bca50327c7f3bea387 to your computer and use it in GitHub Desktop.
Save gest01/07bca50327c7f3bea387 to your computer and use it in GitHub Desktop.
generates a json file with all blog posts and tags for the Jekyll blogging engine (http://jekyllrb.com/)
---
layout: null
---
{
"tags" :
[
{% for tag in site.tags %}
{% assign t = tag | first %}
{% assign posts = tag | last %}
"{{ t }}" {% if forloop.last %}{% else %},{% endif %}
{% endfor %}
]
,"posts" : [
{% for post in site.posts %}
{
"id" : "{{ post.id }}",
"title" : "{{ post.title }}",
"url" : "{{ site.url }}{{ post.url }}",
"date" : "{{ post.date | date: "%B %d, %Y" }}",
"date2" : "{{ post.date | date:"%d.%m.%Y" }}",
"tags" :
[
{% for tag in post.tags %}
"{{ tag }}" {% if forloop.last %}{% else %},{% endif %}
{% endfor %}
]
} {% if forloop.last %}{% else %},{% endif %}
{% endfor %}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment