Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[JekyllBot] Building JSON files

  • Loading branch information...
commit 59f2c82ee9b728b4597c279019e594d37b2415bc 1 parent 0048631
@balterbot balterbot authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  2012/12/27/introducing-jekyllbot.json
  2. +1 −1  feed.json
View
2  2012/12/27/introducing-jekyllbot.json
@@ -1 +1 @@
-{"related_posts":[{"url":"/2010/09/12/wordpress-resume-plugin/","id":"/2010/09/12/wordpress-resume-plugin","title":"WordPress Resume Plugin"},{"url":"/2010/09/13/new-media-flak-megaphone-vs-cocktail-party/","id":"/2010/09/13/new-media-flak-megaphone-vs-cocktail-party","title":"New Media Flak: Megaphone vs. Cocktail Party"},{"url":"/2010/10/10/does-every-cloud-have-a-silver-lining/","id":"/2010/10/10/does-every-cloud-have-a-silver-lining","title":"Does Every Cloud Have a Silver Lining?"},{"url":"/2010/11/06/removing-the-barriers-to-organizational-agility/","id":"/2010/11/06/removing-the-barriers-to-organizational-agility","title":"Removing the Barriers to Organizational Agility\n"},{"url":"/2010/11/08/what-fourteen-century-apple-pie-teaches-us-about-sharing/","id":"/2010/11/08/what-fourteen-century-apple-pie-teaches-us-about-sharing","title":"What Fourteen-Century Apple Pie Teaches Us About Sharing\n"},{"url":"/2010/11/15/will-federal-contracting-officers-soon-have-their-heads-in-the-clouds/","id":"/2010/11/15/will-federal-contracting-officers-soon-have-their-heads-in-the-clouds","title":"Will Federal Contracting Officers Soon Have Their Heads in the Clouds?\n"},{"url":"/2010/11/29/free-trade-in-china-just-google-it/","id":"/2010/11/29/free-trade-in-china-just-google-it","title":"Free Trade in China? Just Google it."},{"url":"/2010/11/29/twitter-mentions-as-comments/","id":"/2010/11/29/twitter-mentions-as-comments","title":"Twitter Mentions as Comments WordPress Plugin\n"},{"url":"/2010/12/01/the-internet-is-series-of-tubes/","id":"/2010/12/01/the-internet-is-series-of-tubes","title":"The Internet is Series of Tubes (oh, and Tollgates too)\n"},{"url":"/2010/12/20/late-night-infomercials/","id":"/2010/12/20/late-night-infomercials","title":"Late-Night Infomercials: Guaranteed to Extend the 4th Amendment or Your Money Back"}],"title":"Introducing Jekyllbot","url":"/2012/12/27/introducing-jekyllbot/","date":"2012-12-27 00:00:00 +0000","id":"/2012/12/27/introducing-jekyllbot","categories":[],"next":null,"previous":"/2012/12/26/securing-the-status-quo","tags":[],"content":"<p>After <a href='http://ben.balter.com/2012/10/01/welcome-to-the-post-cms-world/'>making the move to Jekyll</a>, one thing I lost was the ability to generate machine-readable representations of content. That may sound trivial, but it&#8217;s actually not considering <a href='http://ben.balter.com/2012/12/15/why-wordpress-next-version-should-just-give-it-a-rest-already/'>the RESTful direction we&#8217;re heading</a>, and is crucial if you want to manipulate content on the front-end (e.g., <a href='http://backbonejs.org/'>Backbone</a> ). The idea being, for any post or page, if you simply replace the final <code>/</code> with <code>.json</code>, you should get an API.</p>\n\n<p>I had previously written <a href='https://github.com/benbalter/benbalter.github.com/blob/master/_plugins/generate-json.rb'>a short Jekyll plugin to generate JSON representations of posts</a>, but GitHub Pages (where this site is hosted), doesn&#8217;t allow plugins for security reasons. Enter <a href='https://github.com/benbalter/jekyllbot'>JekyllBot</a>. JekyllBot lives on a (free) Heroku instance, and following any push to GitHub, <a href='https://github.com/benbalter/benbalter.github.com/commit/c9eabc198479277a819ffa2cc95e26880ef3506c'>silently generates JSON files</a> for each post, pushing the changes back to GitHub. No need to do a thing. This allows you to continue to use web-based editors like <a href='http://edit.benbalter.com/'>Prose</a>, and alleviates the need to ever touch the command line.</p>\n\n<p>How does it work? I added my Heroku instance as a post-receive hook in the repository&#8217;s settings page, and have JekyllBot running within <a href='http://www.sinatrarb.com/'>Sinatra</a> to listen for the payload. After a push, it simply runs Jekyll (with the plugin), commits to git, and pushes the repo back to GitHub if there are any changes. The secret lies in the JSON generating plugin, which places the resulting files in the source directory (rather than <code>_site</code>), allowing the files to be tracked by git, and thus silently passed through as static files by GitHub&#8217;s Pages servers when the site is built.</p>\n\n<p>With a little customization, there&#8217;s no reason this process couldn&#8217;t work with most Jekyll plugins (e.g., sitemaps, tag archives), allowing GitHub pages to support much more robust Jekyll implementations from within their existing security restrictions. Feel free to give <a href='https://github.com/benbalter/jekyllbot'>JekyllBot</a> a try on your own site, or simply add <code>.json</code> to the the URL above to see it in action.</p>"}
+{"title":"Introducing JekyllBot","excerpt":"Automatically generate a JSON content API for Jekyll-based posts and pages. Uses Heroku, works with GitHub pages.","author":"Benjamin J. Balter","layout":"post","comments":true,"categories":["Technology"],"tags":["Jekyll","Bot","JSON","API","Open Source","GitHub","GitHub Pages","Heroku"],"published":true,"related_posts":[{"url":"/2010/09/12/wordpress-resume-plugin/","id":"/2010/09/12/wordpress-resume-plugin","title":"WordPress Resume Plugin"},{"url":"/2010/09/13/new-media-flak-megaphone-vs-cocktail-party/","id":"/2010/09/13/new-media-flak-megaphone-vs-cocktail-party","title":"New Media Flak: Megaphone vs. Cocktail Party"},{"url":"/2010/10/10/does-every-cloud-have-a-silver-lining/","id":"/2010/10/10/does-every-cloud-have-a-silver-lining","title":"Does Every Cloud Have a Silver Lining?"},{"url":"/2010/11/06/removing-the-barriers-to-organizational-agility/","id":"/2010/11/06/removing-the-barriers-to-organizational-agility","title":"Removing the Barriers to Organizational Agility\n"},{"url":"/2010/11/08/what-fourteen-century-apple-pie-teaches-us-about-sharing/","id":"/2010/11/08/what-fourteen-century-apple-pie-teaches-us-about-sharing","title":"What Fourteen-Century Apple Pie Teaches Us About Sharing\n"},{"url":"/2010/11/15/will-federal-contracting-officers-soon-have-their-heads-in-the-clouds/","id":"/2010/11/15/will-federal-contracting-officers-soon-have-their-heads-in-the-clouds","title":"Will Federal Contracting Officers Soon Have Their Heads in the Clouds?\n"},{"url":"/2010/11/29/free-trade-in-china-just-google-it/","id":"/2010/11/29/free-trade-in-china-just-google-it","title":"Free Trade in China? Just Google it."},{"url":"/2010/11/29/twitter-mentions-as-comments/","id":"/2010/11/29/twitter-mentions-as-comments","title":"Twitter Mentions as Comments WordPress Plugin\n"},{"url":"/2010/12/01/the-internet-is-series-of-tubes/","id":"/2010/12/01/the-internet-is-series-of-tubes","title":"The Internet is Series of Tubes (oh, and Tollgates too)\n"},{"url":"/2010/12/20/late-night-infomercials/","id":"/2010/12/20/late-night-infomercials","title":"Late-Night Infomercials: Guaranteed to Extend the 4th Amendment or Your Money Back"}],"url":"/2012/12/27/introducing-jekyllbot/","date":"2012-12-27 00:00:00 +0000","id":"/2012/12/27/introducing-jekyllbot","next":null,"previous":"/2012/12/26/securing-the-status-quo","content":"<p>After <a href='http://ben.balter.com/2012/10/01/welcome-to-the-post-cms-world/'>making the move to Jekyll</a>, one thing I lost was the ability to generate machine-readable representations of content. That may sound trivial, but it&#8217;s actually not considering <a href='http://ben.balter.com/2012/12/15/why-wordpress-next-version-should-just-give-it-a-rest-already/'>the RESTful direction we&#8217;re heading</a>, and is crucial if you want to manipulate content on the front-end (e.g., <a href='http://backbonejs.org/'>Backbone</a> ). The idea being, for any post or page, if you simply replace the final <code>/</code> with <code>.json</code>, you should get an API.</p>\n\n<p>I had previously written <a href='https://github.com/benbalter/benbalter.github.com/blob/master/_plugins/generate-json.rb'>a short Jekyll plugin to generate JSON representations of posts</a>, but GitHub Pages (where this site is hosted), doesn&#8217;t allow plugins for security reasons. Enter <a href='https://github.com/benbalter/jekyllbot'>JekyllBot</a>. JekyllBot lives on a (free) Heroku instance, and following any push to GitHub, <a href='https://github.com/benbalter/benbalter.github.com/commit/c9eabc198479277a819ffa2cc95e26880ef3506c'>silently generates JSON files</a> for each post, pushing the changes back to GitHub. No need to do a thing. This allows you to continue to use web-based editors like <a href='http://edit.benbalter.com/'>Prose</a>, and alleviates the need to ever touch the command line.</p>\n\n<p>How does it work? I added my Heroku instance as a post-receive hook in the repository&#8217;s settings page, and have JekyllBot running within <a href='http://www.sinatrarb.com/'>Sinatra</a> to listen for the payload. After a push, it simply runs Jekyll (with the plugin), commits to git, and pushes the repo back to GitHub if there are any changes. The secret lies in the JSON generating plugin, which places the resulting files in the source directory (rather than <code>_site</code>), allowing the files to be tracked by git, and thus silently passed through as static files by GitHub&#8217;s Pages servers when the site is built.</p>\n\n<p>With a little customization, there&#8217;s no reason this process couldn&#8217;t work with most Jekyll plugins (e.g., sitemaps, tag archives), allowing GitHub pages to support much more robust Jekyll implementations from within their existing security restrictions. Feel free to give <a href='https://github.com/benbalter/jekyllbot'>JekyllBot</a> a try on your own site, or simply add <code>.json</code> to the the URL above to see it in action.</p>"}
View
2  feed.json
1 addition, 1 deletion not shown
Please sign in to comment.
Something went wrong with that request. Please try again.