
I read Joel’s post on Using my own domain for Mastodon without hosting a server (kinda), and thought I would do this myself.
The idea is that anyone would be able to look me up on Mastodon using my own domain. So someone could look up @adam@adamsdesk.com, and it would show my actually Mastodon account.
What is WebFinger?
A way to associate information to an email address, or other online service.
Using WebFiger allows for the discovery of information about a people or other entities on the Internet over hypertext transfer protocol (HTTP).
What are the Benefits?
There is not a lot of benefits, but this is all I could come up with after talking about it on Mastodon.
- Discoverability
- Always redirects to your active Mastodon profile
- Validates your domain for your Mastodon profile
Edit Jekyll Config
Add the following to your Jekyll configuration file (_config.yml) so that these values can be referenced to build the webfinger file later. This will allow for ease of changes in the future without touching any code.
There is a Jekyll plugin that could be used, but I prefer not to use plugins when it is simple to do yourself.
1
2
3
mastodon:
instance: fosstodon.org
username: adamsdesk
Create WebFinger File
Create a file called “webfinger” in the root of your website that will have the following contents. When the website builds Jekyll will parse the Liquid template language code, and create a file at the root of the website “.well-known/webfinger”.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
layout: none
permalink: .well-known/webfinger
---
{
"subject":"acct:{{ site.mastodon.username}}@{{ site.mastodon.instance }}",
"aliases":
[
"https://{{ site.mastodon.instance }}/@{{ site.mastodon.username }}",
"https://{{ site.mastodon.instance }}/users/{{ site.mastodon.username }}"
],
"links":
[
{
"rel":"http://webfinger.net/rel/profile-page",
"type":"text/html",
"href":"https://{{ site.mastodon.instance }}/@{{ site.mastodon.username }}"
},
{
"rel":"self",
"type":"application/activity+json",
"href":"https://{{ site.mastodon.instance }}/users/{{ site.mastodon.username }}"
},
{
"rel":"http://ostatus.org/schema/1.0/subscribe",
"template":"https://{{ site.mastodon.instance }}/authorize_interaction?uri={uri}"
}
]
}
Note
By default Jekyll will ignore hidden files/directories (e.g. .well-known). So if you chose to not use the permalink as shown above, make sure to add the include option into your Jekyll config so that ".well-known" will be included in the website build.
This is post 80 of 100, and is round 2 of the 100 Days To Offload challenge.
References
- Binary blue effect. image by geralt, published Jun 6, 2015, Pixabay
- Use your own user @ domain for Mastodon discoverability with the WebFinger Protocol without hosting a server by Scott Hanselman
- Use your own user @ domain for Mastodon discoverability, Masto Guide
- Using my own domain for Mastodon without hosting a server (kinda) by Joel
- WebFinger logo, Wikimedia Commons
- WebFinger. Mastodon documentation
- WebFinger, Wikipedia
- WebFinger
Changelog
-
- add missing tag
- add reference link
-
- fix 100DaysToOffload post count
-
- change 100DaysToOffload message