Creating a static Mastodon user’s archive

The current (4.0.2) Mastodon profile page is bad. Bad because it requires JavaScript to load. If you want to go back in time and look at your own posts it's not convenient, it's just slow.

I find myself wanting to find old posts to re-share or revisit often. So I decided to first build a sitemap.xml to send to Google. The idea was to leverage Google's search engine powers to find my old posts πŸ€” But that is not guaranteed to be indexed. So, it's no good πŸ™…β€β™‚οΈ

βœ‹ Before you say "install Elastic Search" in your instance. I just don't want to do that ☹️ It feels overkill for a single-user instance when I have less than a thousand posts (at the time of this writing).

πŸ’‘ Creating a static HTML with all the posts

What does this repo do?

  • Uses the great script that allows you to connect to an instance (using an access token created from the Mastodon preferences > Development).
  • Uses a very small python script to loop through the posts and generate a simple HTML.
  • It has a GitHub Actions build file that runs every night.
  • The HTML output is then sent to a gh-pages branch to be hosted for free on GitHub Pages.

It's all automatic and I get a simple HTML page with all my posts for each search.

It's fantastic 🀩 (here's the live archive).

I don't know Python but I took advantage of GitHub Copilot to do most of the modifications and fix issues for me 😁

Feel free to fork it and amend it to your needs πŸ’œ


What's next?

You could, if you wanted do more stuff with the HTML page, create secondary pages by hashtag or some sort of other filters (should you have too many to fit in a single page).

For me, this implementation is good enough, all posts on a single page that renders fast and it's easy to search πŸ‘


  1. Daniel says:

    You think it is possible to create a version of this script that also archives attached media files?

    1. Hey Daniel,

      I have no idea. Doesn’t sound straightforward Not sure if the out of the box export via the profile settings does that for you and it’s easier than this script.

Leave a Reply

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