Bringing Static Sites to the Fediverse: Enhancements and Implementations Integrating static sites into this ecosystem via the ActivityPub protocol presents unique challenges and opportunities. In this post, I share recent updates and discoveries from my journey to seamlessly connect static sites to the Fediverse.
Enhancing Content Delivery with Customizable Templates One of the primary goals in integrating static sites with ActivityPub is to ensure that content is delivered effectively within the Fediverse. To achieve this, I’ve introduced customizable templates for note generation. This enhancement allows the full content of a blog post to be included directly in ActivityPub notes, moving beyond mere link sharing—a practice often associated with bots—and leveraging the full potential of the Fediverse.
A rollercoaster of pride, panic, and AI gasliting I code to relax. Some people do yoga, some meditate—I open VS Code at 11 PM like a gremlin-raccoon. Don’t judge.
I work full-time at Microsoft, and between family time and my other hobbies, I somehow keep starting new side projects. I’ve got VocalCat, an AI interviewer for SOMOS.tech, some fediverse experiments, and a Mastodon fork where I play with identity and static blog integrations. And last night, against all common sense, I started another one.
Find the index and earlier parts of this series here.
We’re almost there! Thanks for sticking with me on this journey. In this final part, we’ll integrate replies and comments into your static website.
Motivation Integrating replies is quite similar to how we handled subscriptions. Since our posts now exist in the Fediverse, we want to treat them as first-class citizens. This means replies to our posts should appear on our site.
You can find the index and other parts of this series here.
We are almost done! Thank you for coming all the way into this journey. In this part we will learn how to broadcast (aka federate) your site posts to your folowers.
Overview The federation of your posts (aka. sending your posts to live infitely in the fediverse) is pretty straighforward:
sequenceDiagram BroadcastTool->>Storage: Retrieve followers (actor uris) BroadcastTool->>Follower-instance: Get actor info (including inbox uri) BroadcastTool->>Filesystem: Get note json (post) BroadcastTool->>Follower-inbox: Send a create action (wrapper of note) In a few words, you will iterate your list of followers, get their inbox url, and send a request to such url to create an fediverse object (note, article, etc.).
You can find the index and other parts of this series here.
Let’s dig in into the most controversial part of my guide: the inbox. As far as I know, there is no way to make this inbox static. However, thanks to the fact that ActivityPub does not require the inbox to share the same domain as the other elements, we can host it anywhere.
I believe it could be controversial for two reasons. First, it is not truly static; you require a backend somewhere running on some kind of server. The second reason is that I am using Azure, and I know from the get-go that will put some of you off. But I believe this guide is still valid, as you can easily deploy to AWS, GCP, or even Vercel. I am writing this in .NET, but as you may already know, translating the logic should be trivial for most modern languages. I will actually encourage people to contribute these implementations to my repo and make it our repo.
We will take a break from discussing ActivityPub concepts, and I’ll explain how I implemented a very simple “Subscribe” feature for this blog using Mastodon/Fediverse accounts. You don’t need to have your site/blog ActivityPub enabled for this; you will only need a Fediverse account and basic html/css knowledge.
You can also navigate the other parts of this series here.
The Motivation The motivation behind this simple feature is quite strong:
In this blog post, we will explain how to generate the outbox and notes, ready to be shared in the Fediverse.
You can also navigate the other parts of this series here.
Overview In the previous blog post, we created the actor endpoint as a static file. As explained there, this file has a pointer to the outbox, which is a collection of notes. A note in the ActivityPub protocol represents an activity, such as a toot, photo, comment, etc. (hence the “Activity” in ActivityPub), and in our case, it will be the representation of a blog post.
In this blog post, we will explain how to make your blog discoverable in the Fediverse as an account, and also address some of the annoying pitfalls I encountered. So let’s get started.
You can also navigate the other parts of this series here.
Overview To enable discovery, we need to implement the webfinger endpoint and the actor file.
As shown in the diagram, Mastodon will first reach the webfinger, which points to the actor file. The actor file, in turn, points to other endpoints such as outbox, inbox, followers, and following. I have included this diagram so you can refer back to it for visual cues while reading this post.
In Part 2, we will delve into the design of my implementation. If you want to read about why you should bring your site to the Fediverse, check out Part 1. You can also navigate the other parts of this series here.
So, you’ve decided to bring your blog to the social web, the Fediverse. That’s cool! This guide might be just what you need. And if you’ve got this or any other method working, shoot me a message on the social web, and I’ll gladly follow. But first, a word of caution: if you’re considering adding ActivityPub to your static site (or any site), I strongly suggest you look for existing implementations that could make your life easier:
You can find the index and other parts of this series here.
This blog is on the fediverse! You can discover and follow the blog (@blog@maho.dev) and comment on its posts from your Mastodon app.
I spent the last couple of weeks getting this blog onto the social web (aka fediverse), investing an hour here and there (I hope you are reading this from Mastodon, btw). It was fun and a very exciting learning experience, and I want to share not only my reflections but also create a guide so others can do the same, to move the needle a little bit in the right direction.