ActivityPub Support for Static Sites

Continuing the discussion from :rocket: ActivityPub Rocks Portal: Technical Discussion:

My first reaction to this was (posted in a chat room):

My daily joke take:
That thing with static sites not supporting ActivityPub is really something the W3C WG needs to fix.

Unfortunately, I make bad jokes. So the problem has been floating around in my head. I actually donā€™t think any changes to ActivityPub are necessary for this. What one needs is a service to provide ActivityPub functionality. By this, I mean, the ability to use ActivityPub to interact with the site, e.g. given a page, I can like it.

The entire thing would work like follows:

  • Register a static page with the service
  • Service creates a page object: page_obj
  • Static Page links to page_obj following Test Cases for Discovery of ActivityPub over HTTP
  • Service records interactions with the page object and offers a ā€œConversation / Interactionā€ API endpoint
  • Static Page includes a web component to display the result of the API call

So well, eugh, one can do ActivityPub for Static Sites.

Anybody any comments? Would this enrich the :rocket: Portal?

4 Likes

Doesnā€™t BridgyFed support this kind of functionality? Iā€™ve seen at least one other Fedi discussion about a service like this to support static websites (may have been under development), but unfortunately, I donā€™t have a link or remember the name of the project.

In other words, is there something that can be done so that ActivityPub gracefully degrades to something like RSS when implemented on static (or should we say ā€œstatelessā€) sites?

I like the ā€œstatelessā€ characterization. The issue I see with degrading to RSS is that ActivityPub is primarily a push transport and RSS is a pull transport. Theoretically, servers could poll an AP outbox and that would be similar to RSS. However, I donā€™t know of any servers that do that and I donā€™t think thatā€™s the behavior the AP spec authors intended.

As far as I can tell that requires Webmentions, and thus is not a static feature.

RSS provides the opposite of what Iā€™m interested in. I want to allow people to interact with my site, not allow people to query my site for new content.

If I get you well @helge, you would like some mechanism, e.g., an HTML header, that would associate the static page with an ActivityPub actor.

Then one could imagine a lot of functionality:

  1. when the page is updated, a Note is sent by the actor
  2. people can comment on the page by posting to the actorā€™s inbox
  3. if the actor can keep ā€˜commentsā€™, it can integrate it with the next static page compilation (and eventually goto 1ā€¦)

Somehow this makes me think that the static page could be available at an URL, and also in ERIS URN form. But this is probably another discussion :wink:

Yes, basically I want a way to provide a mechanism to generate a bidirectional link between ā€œStatic Pagesā€ and ā€œActivityPub objectsā€. I actually donā€™t have an opinion which actor they would belong to.

The ActivityPub objects might be something like Proxy Objects. The big challenge here as with all proxying is feeding back the interactions with the ActivityPub object to the static site.

Iā€™m not sure how relevant these are. Iā€™ve had a curiosity about integrating fediverse into static sites myself.

I have stumbled upon two implementations of using the fediverse as a comment system on static site. They piggy back off of the Mastodon infrastructure. They may be of interest in this case:

You can also see them in use on the blogs themselves.

The cassidyjames blog says this about the comment system:
" Iā€™ll leave a lot of the details for his post, but the super-simplified gist is:

  1. Write a blog post
  2. Post about it on Mastodon
  3. Grab the resulting post ID and plug it back into the static site
  4. The blog uses the Mastodon API client-side to fetch replies to the given post
  5. Those replies are spit out onto the page and styled"
5 Likes

Hi DannyMate,

welcome to SocialHub and thanks for your post. I think it puts what I want into perspective:

  • Yes, one can probably use Mastodon to do what I want. I just feel like that Mastodon is a heavy solution ā€¦
  • Second, if I want to have something like comment control. I will have to add this on top of Mastodon or wait for Mastodon to finally implement it. I would want comment control for what appears on my webpage.

I think I have a philosophical problem with it. Iā€™d like my Fediverse applications to be small, instead of one monolith that more and more stuff gets added into.

I think pixels is the perfect Fediverse application in my eyes. Itā€™s just like 200 lines of codes and does one thing.

2 Likes

My favorite option would be to have an actor listening for comment activities and compile new comments and deploy the site automatically. I mean, if the site is static, better avoid JavaScript integrating comments. But that might be yet another development step. I agree that something minimal like pixels would be a good option.

Welcome @dannymate and thank you for your useful input!

Thanks for the welcome :). I hope my input is always useful. Iā€™m not a particularly talkative person so youā€™ll rarely see me around. I also want to point out that this should be possible. Cactus Comments does something similar for Matrix.

So I think weā€™d need a seperate service (as is mentioned in the OP) to provide extra functionality to static sites. In this case lets focus on a comment system. The blogs I provided before piggy-backed off of Mastodon which isnā€™t specialised in any way for this task.

Annoyingly thereā€™s a gap in my understanding for Static sites and comments as it isnā€™t something Iā€™ve implemented before. Iā€™m also not an expert on ActivityPub. But Iā€™ll try my best to break down the requirements.

  • Weā€™ll want to avoid unecessary compilation so client-side comment fetching would be ideal. Therefore we donā€™t really want API calls from Fediverse to Blog. I know @how has voiced an opinion otherwise.
  • An ID system that doesnā€™t require a Post Blog > Reference Blog in Fediverse > Get post ID > Add ID to Blog Post flow. Though itā€™s not a deal breaker.
  • Ideally we can use any ActivityPub compatible software. That way we can use Mastodon or something more single-user like bugle? or something custom. This allows people to avoid having to spin up their own server for comments.
  • We want to be able to control comments. For example, on the fediverse anyone can comment but only certain comments may be accepted onto the site. Or even an explicit approval first comment system.

I wonder if the comment control could be self-hosted seperately from a Mastodon/etc server.

I also found this: https://minipub.dev. It seems to utilise RSS.

Ideally we could rely on the relation between SocialHub account and Fediverse account to provide an AllowList, and have unknown accounts go into moderation. Most users here have put their Fediverse handle in their profile, and the ActivityPub plugin for Discourse now supports associating the two. So if we create a topic for each page, then replying to the topic (via Fediverse) updates the comments. Discourse has client-side integration of comments in this regard.

I must say that the original topic is about generic ways to add ActivityPub support for static sites, but we, especially I, have been talking about a specific use-case so far, related to the :rocket: portal. (not that Iā€™m fond of rockets either.)

Thereā€™s a new matrix thingy that was in the Weekly update called matrix-static.

The ideas & objectives section explains more about the project:
ā€œBe able to share content onto matrix, from an entirely static setup (no dynamic server content generation, no database, just files and folders).ā€
ā€œThe purpose is not yet to have DM communication, but more public content from rooms, displayed via other matrix clients, without being able to participate in it.ā€

It makes me wonder if something like this is feasible with Matrix why couldnā€™t it be done with ActivityPub? Well maybe in the end itā€™ll serve to be impossible but itā€™s worth keeping an eye on.

I donā€™t know anything about the portal but Iā€™m interested in the topic in general. So if this topic is actually intended for the one thing then I doubt I can contribute.

1 Like

Referencing a toot by Dr. Freemo who got static site AP working, and it is live on flear.org.

[ā€¦] you can follow a user, and you get the accept backā€¦ it even sends the create push to followers when new articles come out, so you get it in your feed.

Check it out here: @flear

If anyone comments, stars, or reshares an article on the fedi it shows on the static website as comments on that siteā€¦

Basically all the core features you need are there and working. Feel free to use it

@randName notified me of a collection of resources they have been keeping track of that are relevant to this thread:

1 Like

Hi, I am the dev on this project. I just wanted to let everyone know that I was adding features and the code was broken for a day or two (though I didnt realize it at first. The code has since been fixed along with a ton of new features. I am also working on making the code easier to reuse, once that is done I will make a separate post about it. In the meantime it seems to be fully working so feel free to snatch the code or follow the account:

@flear@flear.org

Eventually I will move this into its own seperate repo as a boilerplate.

2 Likes

This is really cool thanks for sharing.

I see mention to Vercel and Firebase. Do they play a role in how ActivityPub is handled?

Iā€™m wondering if something like this could be made as, say, a Hugo module.

Sadly the firebase and vercel components are where the activitypub magic happens in terms of being able to respond to followers, and sending out create notifications. However if you run it as a purely static site all of the non-dynamic functions should work (for example your outbox will still list the articles and people will see your content from the fediverse but they wont be able to follow you).

1 Like

She is finally done and has a new home!

I made the code mostly configurable via a toml file and some environment variables. So you can spin up your own version of the site very quickly. I also added very detailed step by step instructions anyone can use to bring up a copy of this site for themselves.

I will make its own post on this shortly, but it should be ready to play with . I just wanted to follow up here since this is where it was first mentioned.

Here are some details:

The new website is https://fedipage.com
The new handle to follow it is @fedipage@fedipage.com
The source can be found here: v1.0.1 Ā· Tags Ā· Fedipage / Fedipage Ā· GitLab
Detailed install instructions can be found in the README here: Fedipage / Fedipage Ā· GitLab

Note the old page (https://flear.org) and itā€™s handle will stay up but it will solely post on the topics it was intended to cover (open-source in ham radio).

Some of the features in the release are as follows:

  • Moved almost all site-specific stuff into configuration variables to make form easier install.
  • Organized the layouts/partials so that it is very easy to update the the templates.
  • Requires Vercel and Firebase for full ActivityPub support but will provide limited support as a purely static site as well. Limited support means the account can be seen, and its posts, but following wont be confirmed.
  • Wrote detailed step-by-step install instructions to make it easy for everyone.
  • Supports the following ActivityPub features:
    • Following confirmation
    • Notifications in your feed when new posts are made
    • The various pages show content from the fediverse interacting with it like reboosts, likes, and even replies which show up as comments on the page.
  • Tags are supported with a few options:
    • Tags can be configured to automatically be added to every post.
    • The tags added in the front-matter of a post can be added as fedivese tags. This can be set independently of any default tags.
    • Tags can be rendered invisibly, not showing in the text of the post on the fediverse yet still contain the tag metadata for searches
  • An ActivityPub alias can be set if you have other accounts across the fediverse. The alias can also allow you to migrate existing followers to the web page (untested, proceed at your own risk).
  • Microblog side-panel can be configured to show content from your alias fediverse account.
  • Multiple categories of blogs can be handled simultaniously and categorized and tagged independently.
  • Front page is constructed from markdown and broken up into short codes. So the front page can be modified without touching the html.
3 Likes

FYI: Another project, a bridge implemented in Rust, targeting static sites:

3 Likes