Collate versions on build

Hi Everyone,

I want to create a text file that will contain various information about the build. So something like,

This was built with Jekyll {{ jekyll.version }}

But the only commands I’ve come across are the above and jekyll.environment

I’m looking for things like, jekyll.theme.version which would output minima 1.0.0 for example.

Does anyone know where I can find all possible options for jekyll.OPTION and/or how to go about creating a build info file in _site.

I don’t think Jekyll has that.

You can use Bundler to tell you about the gems you have installed.

bundle list

And you can do some processing at build time to an ignored file. Or run a script manually and commit.

For example you can save the values to a a data file so they are available in Jekyll for rendering on a page.

Bash code:

JEKYLL_INFO=$(bundle list | grep jekyll)
THEME_INFO=$(bundle list | grep minima)

echo "\
- jekyll_info: '$JEKYLL_INFO'
- theme_info: '$THEME_INFO'
" > _data/versions.yml

Then reference as

title: Versions

This site was made with:

- Jekyll: {{ data.versions.jekyll_info }}
- Theme: {{ data.versions.theme_info }}

You can also make a markdown badge manually. And just maintain it when you do change it.

I do that on my README and that work work on a page or whatever.

The service is great for generating badges. It let’s you create a badge that dynamically references a package name in package.json and tells you the version but it does not support that for gems.

One liner in a Makefile (because I use make to build my sites)

bundle list | grep -v ^Use | grep -v ^Gems | awk '{sub(/[ \t]+$/, "", $2); print"-",$2,":",$3}' | sed 's/\ :\ /: /g' > _data/versions.yml

1 Like


Here’s a multi line adaptation of that for Makefile. I think all $ have to become $$.

    bundle list | \
        grep -v ^Use | \
        grep -v ^Gems | \
        awk '{sub(/[ \t]+$$/, "", $$2); print"-",$$2,":",$$3}' | \
        sed 's/\ :\ /: /g' \
        > _data/versions.yml
1 Like

If hosting on Github Pages is an option for you, you could also use the github-metadata gem which exposes the site.github namespace w/in your Jekyll project.

It’ll expose all your gem versions, so will definitely cover your jekyll.version example e.g. via site.github.versions.jekyll.

Not sure if it captures all the variables you need, but the full list can be found here:

1 Like

Clearly I have too much time on my hands :smiley: :laughing:
grep \@bundle Makefile

@bundle list | grep -v ^Use | grep -v ^Gems | awk '{sub(/^\(/, "", $$3);sub(/\)/, "", $$3);printf"- name: %s \n version: %s \n", $$2, $$3}' > _data/versions.yml

and then


title: Software Versions

## Bundle list - Versions

{% for n in %}<li>{{ }} : {{ n.version }}</li>
{% endfor %}

good spotting on the double $'s @MichaelCurrin

1 Like