Could you tell me how to use it?
Closed this issue · 10 comments
Do you mean how to install it or how to execute the queries?
@JimmyLv You can install it via bower, when then compiling it with jekyll it should be available.
Installing via bower
bower install jekyll-rest-api
Then you can access it by
http://myjekyllsite.com/bower_components/jekyll-rest-api/posts.json
@riichard Thank thank you very much! I did it!! BTW: how can I generate each json file for each post, so that I can use path like xxxxx/2016/01/22/React.js-Best-Practices-for-2016.html
easily change to xxxxx/2016/01/22/React.js-Best-Practices-for-2016.json
.
@JimmyLv The best thing you can do is to get all posts, and then filter that specific post you have out of it.
I assume the file isn't that big, and is loaded quickly because the browser doesn't have to render it in the DOM.
If you have a lot of blog posts that this really becomes inefficient, you can make a work-around by creating a fork of your blog, change the layout file in your _layouts folder to generate json, and set up a hook to sync all new posts/updates to your forked _posts folder. It sounds like a lot of work, but if you really need to do it, this is the only way.
i'm closing this issue due to long time no response, hope all is well Jimmy ;)