This is a feature request for support of plugins. Since zola is written in rust and only used with a compiled binary, the direct access for e.g. inserting custom tera functions is strongly limited if not unavailable. While this poses no problems for many applications in my cases, I would propose a way to enable plugin support with dynamic loading to allow advanced users to extend zola without modifying the code itself.
Motivation
While zola has a myriad of well-built features, it still lacks support for some more advanced features, e.g. LaTeX rendering. There may also be some use-cases where specific extensions of e.g. Tera or the support of another feature e.g. support for new data type may be required but can’t be added easily since zola lacks a way to load plugins or extensions on runtime.
Solution
Exposes some sort of plugin system. One way to do this would be to allow the user to dynamically load libraries on runtime, from which specific functions are triggered by zola. Ideally, those libraries could access some sort of API for extending zola.
Alternative Solution
Allow some sort of (Lua) scripts for extending zola. Those scripts may either need to talk to some API or listen to hooks. I don’t really have experience with the background of such systems, but it might be more easy to develop for,
Known Problems
Allowing the user to load plugins always also exposes inexperienced users to some risk with e.g. libraries that corrupt date etc. In addition to potential harmful libraries, the proposed solution could stability and reliability since dynamic loading is, anecdotally at least, very fragile.
I would love to hear what the team behind zola thinks of this idea. My solution is most certainly not the best, and I would love to hear your feedback and suggestions on this topic. While I’m rather inexperienced with rust, I would still love to help with the implementation.
Addressing GitHub comment:
I’m aware that “single binary” distribution is a goal/ feature of zola. A dynamic loading approach wouldn’t impact this feature, since the plugins would be loaded from files as shared libs. This means the plugins would be too distributed separately, but zola’s binary isn’t affected. Since plugins are additional, I don’t see a conflict with „all you need“ since plugins are as the name suggests extensions and not part of the original application.
Moved from: zola#1544