Jekyll is a static-site generator written in Ruby.
On the surface, the Jekyll static site generator is pretty similar to alternatives like Hugo and Zola, but it’s actually much more extensible.
The Plugin System
All you need to do is create a directory in the root folder of your website called _plugins
. You can then put Ruby scripts in that folder.
In these scripts, you can take advantage of hooks, which are functions you write to hook into the Jekyll build system. During the build process, at each step, the functions you wrote are called. Using these, you can extend pretty much every aspect of the Jekyll static site builder.
Some examples of what you can do include:
- Creating RSS feeds.
- Generating SEO markup for all of your pages to improve search engine appearance.
- Supporting entirely different input formats. By default, Jekyll uses Markdown, but you can write a tiny plugin to add support for Emacs Org mode or other formats.
- Introducing an entirely different data source. Instead of just reading markup files, a plugin can connect to a database and use that to include content.
Case Study: Obsidian Integration Plugin
One of my plugins is an Obsidian integration. On top of the blog posts and content in my Jekyll folder, this plugin reads all the files from my Obsidian vault. I have specific exclusion categories for private and work notes, so they are not processed and never become public.
Everything else the plugin finds gets processed. It’s mostly regular markdown processing, but it also handles extra syntax, like Obsidian’s wiki-style links. These are processed properly, titles are generated from the file names, and everything just works. Suddenly, the notes you write and link together in Obsidian can be exported to your personal website and become a part of it.
An External Script: Comment and Spam Filtering
This integration is not done with a plugin but with a separate, server-side script that collects comments from my blog posts and pages.
- Comments are submitted and collected into my ClickHouse database.
- Another external script uses training samples (relevant vs. spam) to train a neural network.
- The network then scores every comment in my comments queue.
- I then approve the comments. This action both marks them as “not spam” to be published on the website and trains the classification system for future samples.
Conclusion
I have a few more useful plugins, but they are very small, “nice-to-have” features. The ones I’ve described are the most important. These kinds of integrations are really annoying to do with other fixed static site generators, but with Jekyll’s flexible plugin system, they are really tiny and easy to write.