Do you have a website or a blog built with Hugo? (of course you do!)
Do you also have a Mastodon account?
Would you like people to be able to find you on Mastodon even using just the domain name of your blog?
For example, if your name is
John Doe and your blog is hosted on
https://www.doe.com wouldn’t it be nice if people could find you by searching for you on Mastodon as
instead of having to remember your looong mastodon account name
All you really need is just to add a single file to your existing website.
The operation is quite simple: every time someone searches for a user on Mastodon (for example:
@email@example.com), the Mastodon server tries to contact the domain (
doe.com) to ask about user credentials, by accessing a page under
https://doe.com/.well-known/webfinger?resource=acct:firstname.lastname@example.org using a GET method.
All my script does is copy these credentials from the Mastodon server that is hosting your account, and insert them into your website or blog created with Hugo in order to mimick the same directory structure.
In order to make it work, after running my script please remember to execute Hugo to build your website again and deploy.
I couldn’t have created this script without the helpful article written by Maarten Balliauw on his personal blog, which you can find at https://blog.maartenballiauw.be/post/2022/11/05/mastodon-own-donain-without-hosting-server.html
You can find my script here: https://github.com/fmaida/mastodon2hugo