This is a read only JSON API, making it easier to connect third party systems to your content, or do more advanced renderings with javascript on your jekyll site that can't be done with the liquid syntax.
_config.yml
.git submodule add 'https://github.com/riichard/jekyll-rest-api'
http://myjekyllsite.com/jekyll-rest-api/posts.json
This also works like a charm on .github.io
URLs.
bower install jekyll-rest-api
http://myjekyllsite.com/bower_components/jekyll-rest-api/posts.json
All output examples can also be found in the output-example
folder.
[
{
"id" : "/The unique ID of the post",
"title" : "The title of the post",
"category" : "demo",
"tags" : "demo,test",
"url" : "/url-according-to-config-defined-formatting",
"path" : "_posts/2015-07-21-demo.md",
"next" : "/path-to-next-post-or-empty-string",
"previous" : "/path-to-previous-post-or-empty-string",
"date" : "2015-07-26 04:00:00 -0400",
"shortdate" : "July 26, 2015",
"content" : "<p>Escaped content</p>",
"excerpt" : "<p>First paragraph of post</p>",
}
....
]
To access this file cross domain, you can load /posts.js
and create a callback function called jekyllPostsCallback
. Due to technical limitations of static file servers it's not possible to pass a custom callback function name.
{
"title": "Richard A. Kraaijenhagen",
"description": "Full Stack Developer & Data Scientist/Visualizer. Founder Owlin.",
"default_bg": "avatar_45.jpg",
"search": "true",
"share": "true",
"readtime": "true",
"wpm": "200",
"baseurl": "",
"fin_color": "255,255,255",
"timezone": "America/New_York",
"encoding": "utf-8",
"categories": [
"owlin"
],
"tags": [
"owlin",
"vim"
],
}
This will contain all keys defined in _config.yml
. Due to a conflict with jekyll, this file couldn't be named config.json
but is named settings.json
instead.
To access this file cross domain, you can load /settings.js
and create a callback function called jekyllSettingsCallback
. Due to technical limitations of static file servers it's not possible to pass a custom callback function name.