Now that Mastodon is more of a thing, I thought I’d set up a static embed of Mastadon posts within Hugo, similar to what I did for Twitter posts.
With the static embedding, I wanted to remove all requirements for JavaScript, and remove all third-party requests on behalf of the users here. In short, this speeds things up, and saves you from worrying about cookies & tracking, or needing to make exceptions to the site’s CSP.
The downside is that it’s a cludge of bash script, JavaScript, Puppeteer, Go, and HTML on the backend. At least nobody else sees that.
It basically loads the embedded version of the post in Chromium, takes a time-stamped screenshot, extracts the post content, and creates an image embed with an alt-tag using a truncated part of the post content. And, links to the post for maximum PageRank, of course. The images & text content are stored in the site’s static directory, making serving easy.
Sample toot / post
Full code is on Github.
Comments / questions
There's currently no commenting functionality here. If you'd like to comment, please use Bluesky and mention me there: @johnmu.com. Thanks!
Related pages
< Mastodon - be findable with your domain (on Firebase hosting)
ESP8266 wifi connection speed optimization >

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.