Linkblog

2026-04-09

I've made a self-updating local copy of my social media feeds, to act as a personal link blog, without having to host a CMS. There is also an RSS feed, but it is entirely redundant, as Mastodon already offers one. The plan is to provide better filtering and categorisation options, over time.

It's a fairly long PHP script. I've run it once locally, pointing it to an archive-data folder that contains the unzipped Facebook, Instagram, and Twitter GDPR-mandated data exports. It also imports from Mastodon and Wordpress using their open API.

It archives all the text in a JSON file, it saves local copies of all embedded media, converting them to optimized format. It also generates an HTML file, containing the JavaScript for loading the content from the JSON file, and an aggregated RSS feed of all posts, from all sources.

Initially I was storing everything directly in the HTML file, so that JavaScript wouldn't be necessary, but once I passed the 5000 posts mark, that became untenable on mobile devices.

I've also added filtering options based on a dropdown menu, which shows how many posts belong to each category. Then I've added a stacked column graph, which allows users to select a (source, year) combination of filters with just one click. Given the massive disparity in the number of yearly posts, I've used a hybrid logarithmic scale: the height of each column is computed logarithmically, but the height of each section of a column is computed linearly.

The stacked column graph, showing how many posts were done on each platform in each year

I've uploaded the HTML page, the compressed media archive, the RSS feed and the PHP script to my server (but not the Facebook, Instagram and Twitter data exports), and I've set up a Cron job to run the PHP script once an hour. It pulls new posts from Mastodon and from my blogs, and adds them to my archive.

This way, I have a fully independent and fully automatic backup of everything I post. On top of that, I can use the mobile interfaces provided by Mastodon and Wordpress to update this site, which remains basically static.