Home / All Plugins

Available Plugins (52)


Top Contributors

Most Forked

Most Watched

Most Starred

Grok is a full stack web shop with engineers specializing in Ruby, Rails, PHP, javascript, databases, and general software architecture based in San Antonio, Texas.

We grok the web!

Plugin Information

jekyll-git-hash

Jekyll Plugin for Git Hash Retrieval


README.md

Copy jekyll-git-hash.rb
file to your _plugins directory.

Use {{ site.data['hash']}} inside your liquid template.

When the site is being generated by Jekyll, the
plugin retrieves Git hash of the source code and
exposes it as a item in site.data. This feature
is very helpful when you want your static resources (CSS, JS, etc.)
be reloaded by end users every time you deploy a new
version of the site.

For example, in your default.html:

<link rel="stylesheet" href="/css/layout.css?{{ site.data['hash'] }}"/>

The URL will be generated with a suffix at the end. This
suffix doesn't change the URL (layout.css will still
be accesible by the browser), but it makes the URL unique
for the browser when you deploy a new Git revision. All browsers
will reload this CSS.