Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
List all posts, tags and categories in Jekyll. https://github.com/zhuochun/md-writer

Markdown-Writer for Atom

List all posts, tags and categories in Jekyll.

Octopress users: if you found " is escaped in the generated JSON file, please change them to \". Refer to this issue.

---
layout: null
---
{
"categories": [
{% for category in site.categories %}
"{{ category | first }}"{% unless forloop.last %},{% endunless %}
{% endfor %}
]
}
---
layout: null
---
{
"posts": [
{% for post in site.posts %}
{
"title": "{{ post.title | xml_escape }}",
"url": "{{ site.url }}{{ post.url }}",
"date": "{{ post.date | date_to_xmlschema }}"
}{% unless forloop.last %},{% endunless %}
{% endfor %}
]
}
---
layout: null
---
{
"tags": [
{% for tag in site.tags %}
"{{ tag | first }}"{% unless forloop.last %},{% endunless %}
{% endfor %}
]
}
@mautematico

This comment has been minimized.

Show comment Hide comment
@mautematico

mautematico Feb 19, 2016

Thank you very much!

Thank you very much!

@JerryChin

This comment has been minimized.

Show comment Hide comment
@JerryChin

JerryChin Jul 3, 2017

That's very helpful!

That's very helpful!

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