Including collections in Jekyll archives
Recently, I decided to upload all my recipes onto my blog, as a convenient way to share them, any modifications I made, and the original source. It also allows me to have a “backup” of them, as the tool that I wrote also exports Paprika’s “importable” format (really just gzip + JSON).
The best way to do this was as a Jekyll collection, which lets
me neatly keep them separate from the actual blog posts.
However, I wanted my recipe categories to be used by
jekyll-archives
as part of tag generation. Normally, this is not supported, but
Ruby monkey-patching allows me to commit the following crime in
a Jekyll plugin (appropriately called
fixup-recipe-tags.rb
):
It’s probably not idiomatic Ruby, but it allows me to add the
following to the
jekyll-archives
section of
_config.yml
:
With that, the recipes are used for tags, but they’re not emitted into the category pages or date-based archives. They’re also not emitted into my “tagged” page, because that only works with the posts collection.
Leave a comment