Link your Hugo website and Mastodon Account together: Make Your Blog Discoverable with Just Your Domain Name

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 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

And what if I tell you that you don’t need to install and set-up a Mastodon server to obtain this?

All you really need is just to add a single file to your existing website.

I’ve created a small Python script to help you do this automatically in less than a minute

The operation is quite simple: every time someone searches for a user on Mastodon (for example:, the Mastodon server tries to contact the domain ( to ask about user credentials, by accessing a page under 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

You can download my script from this URL

You can find my script here: