I thought I could use JavaScript magic in Liquid templates because I came across a {% javascript %}
or something like that mentioned somewhere but it must have been some random custom tag and I didn’t know anything about custom tags at the time.
That however put me on the right path and I rewrote the sidebar generation and made it into a Ruby plugin which reduced the build time to a mere 7 seconds! That’s more like it