Closed erikw closed 3 years ago
Well since I made a minimal example, it was very easy for me to take a close look and I found the issue very quickly!
I simply needed to add in _config.yml
:
plugins:
- jekyll-git_metadata
and then it works!
I was assuming that this was not necessary as it says at https://jekyllrb.com/docs/plugins/installation/#the-jekyll_plugins-group about the Gemfile :jekyll_plugins
group:
Jekyll gives this particular group of gems in your Gemfile a different treatment. Any gem included in this group is loaded before Jekyll starts processing the rest of your source directory.
A gem included here will be activated even if its not explicitly listed under the plugins: key in your site’s config file.
Because of this, I never use the plugins
key in the Jekyll _config.yml
and just use the :jekyll_plugins
group in the Gemfile, as seen in the minimal repo as well: Gemfile#L15-L18.
This works for all Jekyll plugins that I use, but not this one apparently as demonstrated in the minimal example I setup.
For me there is not a workaround. I'm not sure if I should leave this issue open though. If i understand the official Jekyll documentation correctly, the plugin should work still if only added to the build group but not set in the Jekyll configuration file. What do yo say @ivantsepp ?
I discovered now that there are more plugins that silently fail too when building in this way. My bad! I'll close this issue
Hey,
first thanks for making this nice plugin. I'm looking forward to #25!
I noticed as I migrated my website's build process to rake that this plugin does not work when building with Jekyll command ruby interface. It does work perfectly when building with the Jekyll shell command like
$bundle exec jekyll build
.I built a minimal website showing off this problem here erikw/jekyll-3.x.x-test/ (linked branch: jekyll-git_metadata)
The relevant snippet from the Rakefile would be:
There are no build errors but silently there is no output for the variables the plugin provide e.g.
{{ site.git.last_commit.short_sha }}
will just render to an empty string. See the index.md. There is also no.git-metadata/
directory generated.Note that if swapping the
Jekyll::Commands::Build.proces()
for the line undersh 'jekyll build'
it all works perfectly and the git last commit short SHA is shown in the generatedindex.html
.What could the problem be here? Everything else works perfectly when using the ruby build interface for Jekyll, it's just this plugin that's troublesome for me, as shown in the minimal example repo I created.
Versions used can be seen in the example Gemfile /Gemfile.lock.