Skip to content

Instantly share code, notes, and snippets.

@alx
Created December 6, 2010 14:24
Show Gist options
  • Save alx/730347 to your computer and use it in GitHub Desktop.
Save alx/730347 to your computer and use it in GitHub Desktop.
Jekyll plugin to add Git activity inside a list
require 'git'
module Jekyll
class GitActivityTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
end
def render(context)
result = ""
g = Git.open(File.join(Dir.getwd, ".."))
index = 0
g.log.each do |log|
if(index < 10)
result << "<li>"
result << log.date.strftime("%d %b")
result << " - <a href='http://git.tetalab.org/index.php/p/jekyll/source/commit/"
result << log.sha
result << "/'>"
result << log.message
result << "</a></li>"
index += 1
end
end
"<ul>#{result}</ul>"
end
end
end
Liquid::Template.register_tag('gitactivity', Jekyll::GitActivityTag)
@aledoroshenko
Copy link

@heyLu: I forgot to install git :) When installed it and set my path in Git.open, all works great. Thanks!

@streambinder
Copy link

I configured Jekyll on a Github Page.
Can I have a ultra-detailed how-to about how to include this plugins to make it work on my site, configured as written above?

Copy link

ghost commented Dec 31, 2015

@streambinder You can still use plugins on gh-pages, but you have to push the static files instead of the Jekyll files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment