I wonder how that scales. I'm sure it wouldn't matter too much for a small personal blog but I assume the mastodon server wouldn't be very happy if the API was queried at a high rate.
Yeah, I made a note of that. I'm not sure anything I've written to my cheesy blog has hit HN before, so this is probably the biggest test I'm going to get.
If it were going to get any bigger, I'd want my own Mastodon server.
Edit: this is also why I made it an explicit user action to load the comments.
I like caches with a short TTL. Even caching for a single second will cap the amount of API requests. Just setting an expiry a minute out when you generate the page and put it behind a decent caching reverse proxy, is a decent option. Or just write the API response to a file and stat that file to check age before you respond (if so, just make sure to avoid race conditions; e.g. write to a separate file and rename). If you have something like Redis running, that's of course a great option too.
(but just having users click a button is likely to be more than enough)