Last active
March 15, 2020 12:20
-
-
Save rampatra/82776daacc2ece5a9d230d6f7d1538b5 to your computer and use it in GitHub Desktop.
Generate a json file with all the posts in your Jekyll website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
layout: null | |
--- | |
[ | |
{% for post in site.posts %} | |
{ | |
"title" : "{{ post.title }}", | |
"url" : "{{ post.url }}", | |
"date" : "{{ post.date | date: "%b %d, %Y" }}", | |
"content" : "{{ post.content | strip | strip_html | strip_newlines | replace: '"', '' | slice: 0, 600 }}" | |
}{% if forloop.last %}{% else %},{% endif %} | |
{% endfor %} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I needed this to add search functionality on my Jekyll website: https://blog.rampatra.com/how-to-add-search-in-jekyll