A friend of mine and I spent about five hours building this into Hugo. Here is Jamin’s version. You can find the source code on GitHub here.

Incredibly, we embedded WASM running from Rust into this Hugo blog post. The most difficult part involved shoe-horning the WASM into Hugo.

It uses three files:

wasm-game-of-life.js <--- Previously known as bootstrap.js

We build those in a separate apps/ directory and copy them over.

We then load wasm-game-of-life.js through a Hugo shortcode:

<script type="text/javascript" src="{{.Get "src"}}"></script>
<pre id="game-of-life-canvas"></pre>

For details see https://rustwasm.github.io/docs/book/game-of-life/hello-world.html

The above renders Conways Game of Life.