Petter Hassberg proposed a simple and interesting plugin architecture for Plerd posts in November. It currently exists as a pull request biding its time in Plerd’s GitHub repository, with some attached discussion.
With these changes applied, Plerd no longer limits its processing to Markdown files; instead, it looks up every source file against an internally defined table that pairs file-types with file-processing code. This table’s default state would have only one entry, instructing Plerd to treat Markdown files exactly as it already does. Third-party plugin modules loaded by Plerd would have access to this table, however, and thus folks could extend Plerd’s ability to publish different posts depending upon the flavor of its input files.
Petter himself has been using this to run his own Plerd-based blog as a photo album: he drags JPEG files into his source directory, and Plerd immediately turns each one into a complete blog post, using the JPEG files’ metadata as needed to add title and other information to the posts’ textual content. Since the plugin has full control of Plerd’s faculties while processing its posts, it can do more that creating HTML files for every post; in this case, it also copies the JPEGs into the docroot, and runs filters on them. I think that’s pretty cool!
All that said, I feel hesitant to architecture this feature into core. It’s not something that I myself have use for right away, and technically one could reproduce this behavior with Plerd as-is, perhaps writing a little script that moves the JPEG into the docroot, creates a Markdown file linking to it, and then feeding that to Plerd. But I can see the appeal and fun of watching Plerd itself do all the work, too!
I would be very interested to hear other potential applications of this idea. Would this inspire you to create interesting blog-growing plugins for certain file types? Ought it inspire me in ways that I haven’t imagined, yes? Drop me a note, or comment on that GitHub thread.
If a page elsewhere on the web responds to or otherwise mentions this post, you may provide its URL here.