Embedding Mastodon Posts Static and Privacy-Focused Way

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 loads the embedded version of the post in Chromium, takes a time-stamped screenshot, extracts the post content, and creates an image embedded 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

John Mueller posted: Want to follow the world of #SEO ? Click the hashtag and follow it. That way it shows content from across servers, which seems like a useful thing (until it's full of SEO #spam ,  ...

View post

The full code is on GitHub.

See also  How to Make Your Mastodon Profile Discoverable Using Your Own Domain on Firebase Hosting
Mohamed SAKHRI
Mohamed SAKHRI

I'm the creator and editor-in-chief of Tech To Geek. Through this little blog, I share with you my passion for technology. I specialize in various operating systems such as Windows, Linux, macOS, and Android, focusing on providing practical and valuable guides.

Articles: 1273

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *