Hi there, I’m considering migrating https://chrisdown.name from Jekyll to Zola, since it’s the last thing I really use in Ruby. Most plugins are easily able to be rewritten as shortcodes. One I am not sure about the best way to go about is this one:
module GitRevPlugin
class GitRev < Jekyll::Generator
safe true
def generate(site)
site.data['gitrev'] = %x(git rev-parse --short HEAD).strip
end
end
end
I then use this as a cache key later to make sure the version of the CSS is the same as the page being displayed:
<link rel="stylesheet" href="/css/style.css?{{ site.data["gitrev"] }}">
I see a couple of ways I could do this in Zola, but both seem less than ideal since they both rely on an external build script:
- Dynamically generate a shortcode with a build script before running Zola, embedding the current git revision.
- Put the current git revision in an environment variable using a build script, and then query that from a shortcode.
Is there some way to avoid having to create an external build script for this? Thanks!