Skip to content

Instantly share code, notes, and snippets.

@jpalala
Last active January 17, 2021 12:30
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 jpalala/4bca6da81ff6d187644814c4c155f16c to your computer and use it in GitHub Desktop.
Save jpalala/4bca6da81ff6d187644814c4c155f16c to your computer and use it in GitHub Desktop.
Better way to create a site.json file for jekyll to output your posts as json
---
layout: null
---
[
{% for post in site.posts %}
{
"title" : "{{ post.title }}",
"url" : "{{ post.url }}",
"date" : "{{ post.date | date: "%B %d, %Y" }}",
"content" : "{{ post.excerpt | remove: '<p>' | remove: '</p>' | strip_newlines }}"
} {% if forloop.last %}{% else %},{% endif %}
{% endfor %}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment