Yesterday I wrote about a new “blog feature” showing below a post places on this blog where the post was mentioned. Unfortunately this has a high complexity and is not very fast. Today I tried (and managed) to improve the algorithm so that the complexity is just O(n). However, the code does not work as I expected it to, because Hugo does not provide a way to use global variables.

I wonder when the point comes where it is too much effort for me to find workarounds and I just build my own page generator according to my own needs… Most of my blog setup I have already developed myself.

@en Don’t know the first thing about Hugo, but an SSG like Jigsaw lets you iterate over a, say, posts collection _before_ actually generating any HTML. And, hopefully, run a regex on each post’s body, the outcome of which you could save to a flat file (or keep in memory), and then loop through, adapting only the posts that need updated. I also noticed a reader mention webmentions: that’s literally what I do. My blog sends itself webmentions, the exact way it sends ’em to other sites.

Sign in to participate in the conversation
Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!