mirror-web/_plugins/jekyll-git-hash.rb
Miao Wang 3e2e47a3d8
Add cache buster
Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
2021-06-23 15:16:57 +08:00

22 lines
524 B
Ruby

# Jekyll plugin for generating Git hash
#
# Place this file in the _plugins directory and
# use {{ site.data['hash'] }} in your Liquid templates
#
# Author: Yegor Bugayenko <yegor@tpc2.com>
# Source: http://github.com/yegor256/jekyll-git-hash
#
# Distributed under the MIT license
# Copyright Yegor Bugayenko, 2014
module Jekyll
class GitHashGenerator < Generator
priority :high
safe true
def generate(site)
hash = %x( git rev-parse --short HEAD ).strip
site.data['hash'] = hash
end
end
end