Skip to content

Instantly share code, notes, and snippets.

@rampatra

rampatra/site.json

Last active Mar 15, 2020
Embed
What would you like to do?
Generate a json file with all the posts in your Jekyll website
---
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 %}
]
@rampatra

This comment has been minimized.

Copy link
Owner Author

@rampatra rampatra commented Mar 15, 2020

I needed this to add search functionality on my Jekyll website: https://blog.rampatra.com/how-to-add-search-in-jekyll

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.