Displaying repository details on github hosted jekyll blog using Jquery
16 October 2013By Bhavyanshu Parasher
Overview
I just wanted to list the names of my on-going projects on github right on my blog so that visitors can really look at the work i have done so far or the work i am doing. I google’d for stand-alone jekyll plugins and already built modules that could be integrated with jekyll blog but nothing worked like i wanted.
So i went on and built my own script to do this task. I used javascript & jquery to achieve this. You can look at the demo on “My projects”.
Requirement
Make sure you have latest jquery. That’s all.
Tutorial
I won’t be showing you the css for it because that way you can style it yourself according to your site. I am pretty sure of that. I will just show you the javascript code for it.
First of all create a page/post where you want to list the names of the projects. It will create a .md file. You can also add a simple html file if you wish to. That’s just upto you. Now make a gitquery.js file and copy/paste the below given contents.
Code - gitquery.js
Let us take a look at what all info you can fetch using github API. Take a look at the snippet of the JSON response.
Code - Snippet of Json Response from Github API
Now create a .html file or .md file and include the code below. display-projects is a div element where the fetched result will be displayed.
Code - html file
That’s all. If you still encounter some issue, either comment below or simply drop me an email at [email protected] . You can also follow via twitter.