Add configuration for adding required gems programmatically
I wasn't able to make adding the dependencies programmatically. I think it does not work because Jekyll needs to be told which gems are required before the generation starts. With the plugins being declared in _config.yml
, the following line exists in the log:
Pagination: Complete, processed 1 pagination page(s)
Without the plugin being declared, the line is missing from the log.
That's the code I have tried:
if site.config["gems"].nil? || site.config["gems"].empty?
site.config["gems"] = ["jekyll-include-cache", "jekyll-paginate-v2"]
else
if not site.config["gems"].include? 'jekyll-paginate-v2'
site.config["gems"].unshift("jekyll-paginate-v2")
end
if not site.config["gems"].include? 'jekyll-include-cache'
site.config["gems"].unshift("jekyll-include-cache")
end
end
As a workaround I'll open a MR to the readme saying they need to be declared.