A while back I moved my website to Jekyll for all the static-y goodness that provides. Recently I was looking to add Mastodon to my domain as well. Doing so with Jekyll isn’t hard, but searching for it seemed like something no one had written up. For your searchable pleasure I am writing it up.

I used Masto.host to put the Mastodon instance at social.gould.cx. But I wanted my Mastodon address to be @ted@gould.cx. To do that you need to link the gould.cx domain to point at social.gould.cx. To do that you need a .well-known/host-meta file that redirects webfinger to the Mastodon instance:

<?xml version='1.0' encoding='UTF-8'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>

<!-- Needed for Mastodon -->
<Link rel='lrdd'
 type='application/xrd+xml'
 template='https://social.gould.cx/.well-known/webfinger?resource={uri}' />

</XRD>

The issue is that Jekyll doesn’t copy static files that are in hidden directories. This is good for if you have a Git repository, so it doesn’t copy the .git directory. We can get around this by using Jekyll’s YAML front matter to set the location of the file.

---
layout: null
permalink: /.well-known/host-meta
---
<?xml version='1.0' encoding='UTF-8'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>

<!-- Needed for Mastodon -->
<Link rel='lrdd'
 type='application/xrd+xml'
 template='https://social.gould.cx/.well-known/webfinger?resource={uri}' />

</XRD>

This file can then be placed anywhere, and Jekyll will put it in the right location on the static site. And you can folow me as @ted@gould.cx even though my Mastodon instance is social.gould.cx.


posted Jan 29, 2018 | permanent link