getzola / zola

A fast static site generator in a single binary with everything built-in. https://www.getzola.org
https://www.getzola.org
MIT License
13.61k stars 950 forks source link

Feature request: ActivityPub support #2665

Open lkdm opened 1 week ago

lkdm commented 1 week ago

Read-only ActivityPub feeds for Zola

I created this issue to discuss the feasibility of adding a feature to Zola that serialises posts to ActivityStream 2.0 format for ingestion by other federated instances.

What is ActivityPub?

ActivityPub is a standard that allows different web applications to interact so information can be pooled across different instances.

It supports social networking, such as Mastodon or Lemmy, but can also be used for blogging in the case of Plume, Write Freely, and Wordpress through a plugin.

Why

Why not use Plume or Write Freely? Because to my knowledge they are not statically rendered, and thus cost a lot more than running Zola locally and hosting the HTML on a free/cheap host.

Why ActivityPub? Because the new Federated internet runs on ActivityPub. Adding read-only ActivityStream 2.0 support to Zola would allow social networks, or even other applications to subscribe to Zola blogs.

One of the big issues with self-hosting a blog is discoverability. A self-hosted blog from Zola is an island, unlike a blog post on Medium or Substack. Integrating with the Fediverse would help with this.

How ActivityPub works

ActivityPub works by establishing an INBOX and OUTBOX for an actor.

Because Zola renders a static website, it is probably not feasible to implement an ActivityPub "Inbox" and therefore, comments.

However, an outbox activity stream could be published alongside the static HTML– so that federated instances may subscribe to Zola blogs.

Format Examples

Here are some examples of Activity Stream 2.0 objects that I found in the W3 specification that could be suitable:

Post Detail endpoint

{
      "@context": "https://www.w3.org/ns/activitystreams",
      "summary": "Martin added an article to his blog",
      "type": "Add",
      "published": "2015-02-10T15:04:55Z",
      "actor": {
       "type": "Person",
       "id": "http://www.test.example/martin",
       "name": "Martin Smith",
       "url": "http://example.org/martin",
       "image": {
         "type": "Link",
         "href": "http://example.org/martin/image.jpg",
         "mediaType": "image/jpeg"
       }
      },
      "object" : {
       "id": "http://www.test.example/blog/abc123/xyz",
       "type": "Article",
       "url": "http://example.org/blog/2011/02/entry",
       "name": "Why I love Activity Streams"
      },
      "target" : {
       "id": "http://example.org/blog/",
       "type": "OrderedCollection",
       "name": "Martin's Blog"
      }
    }

Post List endpoint

{
      "@context": "https://www.w3.org/ns/activitystreams",
      "summary": "Sally's posts",
      "type": "OrderedCollection",
      "totalItems": 2,
      "orderedItems": [
        {
          "type": "Post",
          "name": "Meeting 2016-11-17"
        },
        {
          "type": "Post",
          "name": "Reminder for Going-Away Party"
        }
      ]
    }

Comment

I am somewhat familiar with Rust, so am happy to at some point commit some time to working on this (not until at least next year)– but I wanted to raise it first to check if it's feasible, desired, and worthwhile.

Action items

Links

Keats commented 6 days ago

If I remember correctly someone wanted to do that before but it was not super practical. Maybe it's in the issues or the forum?

lkdm commented 4 days ago

@Keats I did have a quick search through the issues before posting and couldn’t find anything

Keats commented 2 days ago

Argh I swear it was talked about somewhere but I can't remember