Adding excerpts to Webby

So after revisiting my blog I realized that descriptive tutorial entries with code segments are helpful, but they are…long. The front page of my blog was being dragged way too long by those entries. Thus, I needed to add an “excerpt” feature that allows me to partially display an entry and add a ‘read more…’ link for the full post. Rien Heinrichs has done exactly that with his blog created with Webby, and his github page contains the source. I took a look and turns out it was a lot easier than i thought. Here is how to do it:

Added blog tags in Webby

I just found out that Webby is no long under active development =(. What a sad piece of news. However, with the current Webby version, it’s still good enough for me to maintain my blog. Since it’s relatively easy to extend, I decided to add tags to Webby.

I saved a link to Aarom Qian blog post about adding tags to Webby a long time ago, but unfortunately the blog is no longer online. I dug around and was able to find his github repository and the raw textile/erb entry in there. You can see it here: Adding Blog Tags using Webby.

In general his directions were pretty clear and everything worked well. It explained how to setup the tags framework and how to use rake tasks to generate the tag pages. However, I did need to make some minor hacks to get it working. I’ll try to add a tutorial blog entry if i have time. I’d also be more than happy to answer any questions if anyone is having trouble implementing tags.

In the mean time, try to follow along his post, or check out the source of this blog on my github account. Enjoy!

In my last entry I covered how to integrate facebook api with ruby on rails using fb_graph gem. There is one problem with integrating the facebook api with your website however, and that is if facebook goes down, then your site also crashes. Yesterday facebook went down, along with the api. As a result, one of the sites I was managing went down since it kept waiting to authenticate with the facebook graph api. Now there are definitely other solutions around this, but I also found that when using facebook integration on websites, the websites load a little slower because it has to connect to facebook first, fetch the data, then render the webpage, so the performance of the webpage will heavily depend on the speed of the facebook fetch. Thus, I decided to implement a caching scheme that synchronizes a local database with information fetched from facebook. This way my page only needs to access a local database every time it’s queried, but the database is synced with facebook information, so it’s pretty much like I’m accessing facebook!!

The basic idea is as follows:

  1. Create a table that stores the information you want from facebook
  2. Setup a ruby script that uses the fb_graph gem calls to update the database
  3. Setup that ruby script as a cron job on the webserver and run it as frequent as you like
  4. Change your fb_gem calls to local database calls
  5. Sit back and let the webserver do the hard work!

(09/25/10) Edit: A working version of this source code is uploaded here. Download it and follow the README to try it out!

While working on our church website, integrating with our church’s facebook fan page became a desired feature so our site maintenance team can just add an event on facebook and have it synced up to our website.

After learning about the facebook graph api, I was planning to write a library for ruby that sent out the queries and parsed the results to display on our site. However, I found the fb_graph gem written by Nov Matake and decided to try it out. The experience was extremely positive and Nov was very helpful and prompt in responding to my emails. Here’s how I integrated the facebook graph api into a ruby on rails app:

my pic Isaac Liu is currently a software engineer at Apple Inc. working on the iOS performance team. He received his Ph.D in Electrical Engineering and Computer Science at the University of California, Berkeley . His research focus was in real time systems, parallel architectures and programming models. His thesis can be found here
read more…

office 2 Infinite Loop, Cupertino, CA
email liu (dot) isaac (at) gmail (dot) com
cv html / pdf [ updated: 9/05/11 ]
others facebook linkedin twitter picasa github

Recent Blog Entries