# Wasm extensions

**URL:** <https://zola.discourse.group/t/wasm-extensions/2921>\
**Category:** Feature requests\
**Created:** [March 22, 2026, 12:49pm UTC](https://zola.discourse.group/t/wasm-extensions/2921 "2026-03-22T12:49:31Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![asibahi](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/asibahi/32/1567_2.png) [@asibahi](https://zola.discourse.group/u/asibahi)\
**Post date:** [March 30, 2026, 10:11pm UTC](https://zola.discourse.group/t/wasm-extensions/2921/3 "2026-03-30T22:11:46Z")

</div>

So, browsing the zola codebase, I think the main gateay for making this happen is to use Tera’s `register_function`. Basically, after loading the WASM module, the exported functions are enumerated (with their signature). Instances of a hypothetical `PluginFunction` type (which implements the Tera `Function` trait) are created for each of these WASM functions, and .. Bob’s your uncle.

As a first experiment, I’d restrict exported functions to strictly take strings (or `[u8]`), and have the template user pass the output of things like `get_page` and `page.description` and what have you. The output would be similarly a stream of bytes, the encoding of which is determined by the plugin author. (could be an image ..)

So far, this closely mirrors the Typst architecture, incidentally, and it is specifically for pure functions only with no interaction with the file system, unless ..

No need for WASI shenanigans at all, but Zola could expose a number of functions that WASM modules can import. One possible idea of these functions would be `create_file` to create a file. `create_file` would take as input the file content (say a created image) and a desired file name and/or extension; and give as output the final path which then can be passed on to the exported functions. Implementation of this function is opaque to the module, but could for example create `plugins/` directory in `public` where these files are saved. Any further capabilities to the plugin system would simply be more exposed functions to the modules (say a json site map .. the sky is the limit).

Plugins could even be registered wither with shortcode functions or global functions (with different exposed functions, maybe?). Say plugins in `plugins` directory register with globals and in `plugins/shortcodes` register with shortcods.

I’d be happy to work on this if y’all like the idea. It is not difficult work (I’ve done it before) just a bit time consuming.

---

_[View the full topic](https://zola.discourse.group/t/wasm-extensions/2921)._
