The bin/run_this_first
script customizes your new Jekyll plugin gem.
It does the following:
PLUGIN_README.md
to README.md
.The customized gem is ready to be pushed to RubyGems.org
, or any other Ruby gem repository, whenever your feel ready.
Clone this repo into a directory called my_plugin
, or whatever you want to call your plugin.
$ git clone https://github.com/mslinn/jekyll_plugin_template.git my_plugin
Or, if you have forked the project, replace mslinn
below with your GitHub user id:
$ git clone [email protected]:mslinn/jekyll_plugin_template.git my_plugin
Change directory to the new plugin project:
$ cd my_plugin
Run the customization script and answer the prompts.
$ bin/run_this_first
Open the project in Visual Studio Code and explore the project:
$ code .
Build the plugins provided with this template.
$ bundle exec rake install
You can now use your new Jekyll plugins in a Jekyll website.
a) Add the following to your Jekyll website's Gemfile
.
The installation script had you rename the plugin template from jekyll_plugin_template
to a name of your choosing.
Use that name instead below:
group :jekyll_plugins do
gem 'jekyll_plugin_template'
end
b) Add the following you your Jekyll website's _config.yml
to set log levels for each type of plugin from the template.
Customize the log levels as desired:
plugin_loggers:
CleanHook: info
DocumentHooks: warn
MyBlock: info
PageHooks: warn
PostHooks: warn
PluginMetaLogger: info
SiteHooks: info
Delete the portions of the template that you do not need.
Debug the Jekyll plugin if required.
Publish the gem when ready:
$ bundle exec rake release
Please see the blog post about this {% href https://mslinn.com/blog/2022/03/28/jekyll-plugin-template-collection.html Jekyll plugin gem template %}.
The Jekyll documentation does not indicate the exact order that each of the 45 hooks gets called.
However, the log output from this template makes that clear.
Following is elided output; I removed duplicate log entries.
All loggers were set to level info
.
Output will vary, depending on the Jekyll site that is processed and the log levels you set.
:post_init
, in particular, gets called many times.
INFO Module: Jekyll::Hooks.register(:site, :after_reset) invoked.
INFO Module: Jekyll::Hooks.register(:pages, :post_init) invoked.
INFO Module: Jekyll::Hooks.register(:documents, :post_init) invoked.
INFO Module: Jekyll::Hooks.register(:posts, :post_init) invoked.
INFO Module: Jekyll::Hooks.register(:site, :post_read) invoked.
INFO Module: Jekyll::Hooks.register(:pages, :post_init) invoked.
INFO Module: Jekyll::Hooks.register(:site, :pre_render) invoked.
INFO Module: Jekyll::Hooks.register(:pages, :pre_render) invoked.
INFO Module: Jekyll::Hooks.register(:pages, :post_convert) invoked.
INFO Module: Jekyll::Hooks.register(:pages, :post_render) invoked.
INFO Module: Jekyll::Hooks.register(:site, :post_render) invoked.
INFO Module: Jekyll::Hooks.register(:clean, :on_obsolete) invoked for [].
INFO Module: Jekyll::Hooks.register(:pages, :post_write) invoked.