Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@shawngraham
Forked from zhuochun/README.md
Created March 21, 2016 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawngraham/c41dd05dd2f0259091ba to your computer and use it in GitHub Desktop.
Save shawngraham/c41dd05dd2f0259091ba to your computer and use it in GitHub Desktop.
List all posts, tags and categories in Jekyll. https://github.com/zhuochun/md-writer

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 %}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment