Experimental readonly ActivityPub enpoint for Pelican
Find a file
2022-11-18 01:09:40 +01:00
.gitignore Initial commit 2022-11-17 01:49:09 +01:00
__init__.py Initial commit 2022-11-17 01:49:09 +01:00
activitypub.py Fix hostmeta 2022-11-18 01:09:40 +01:00
LICENSE Add readme 2022-11-18 00:59:53 +01:00
README.md Add readme 2022-11-18 00:59:53 +01:00

ActivityPub Pelican Plugin

Warning: This is an experimental plugin, which most likely does not do what you'd expect it to do. Please read https://s3lph.me/activitypub-static-site.html for details.

Configuration

Add the following to your pelicanconf.py:


# Enable the plugin
PLUGINS = ['activitypub']

# Configure the author's profiles:

ACTIVITYPUB_AUTHORS = {
    # This user will be known as @alice@{{ SITEURL }} in the Fediverse
    'alice': {
        'name': 'Alice',
        'movedTo': 'https://fedi.example/users/alice',
        'alsoKnownAs': ['https://fedi.example/users/alice'],
        'summary': 'Hi, I\'m Alice!  Please follow me at @alice@fedi.example.',
        'attachment': [
            {
                'type': 'PropertyValue',
                'name': 'Mastodon',
                'value': '<a href="https://fedi.example/@alice">@alice@fedi.example</a>'
            }
        ],
        'icon': {
            'type': 'Image',
            'mediaType': 'image/png',
            'url': SITEURL + 'authors/alice.png'
        }
    }
}

Apart from the ActivityPub resources, this plugin will also generate the following resources:

  • .well-known/host-meta
  • .well-known/nodeinfo
  • .well-known/webfinger

If your Pelican site has multiple autors, you need to redirect /.well-known/webfinger?resource=acct:alice@example.org to /.well-known/_webfinger/alice. This can e.g. be achieved with Apache .htaccess:

RewriteEngine on
RewriteRule ^/.well-known/webfinger?resource=acct:([^@]+)@example.org$ /.well-known/_webfinger/$1 [L]

Apart from that, the following Content-Types have to be overwritten (again in Apache config):

<Location /activitypub>
    Header set Content-Type "application/activity+json; charset=utf-8"
</Location>
<Location /.well-known/host-meta>
    Header set Content-Type "application/xrd+xml; charset=utf-8"
</Location>
<Location /.well-known/webfinger>
    Header set Content-Type "application/json; charset=utf-8"
</Location>
<Location /.well-known/nodeinfo>
    Header set Content-Type "application/json; charset=utf-8"
</Location>