Ronalds Vilciņš

Use your website hosted on Netlify as an alias for your Mastodon username

  1. Install netlify-plugin-mastodon-alias
npm install netlify-plugin-mastodon-alias
  1. Configure WebFinger by adding the following to your netlify.toml file
[[plugins]]
package = "netlify-plugin-mastodon-alias"

[plugins.inputs]
    username = "${MASTODON_USER}"
    instance = "${MASTODON_DOMAIN}"
    # delete or comment the next line if you want "*@${ALIAS_DOMAIN}" to work rather than just "${ALIAS_USER}@${ALIAS_DOMAIN}"
    strictUsername = "${ALIAS_USER}"
  1. Build site.

By default this will redirect any username on your domain to this username. For example both @[email protected] and @[email protected] would work.

Without netlify plugin

Add a rewrite rule in netlify.toml file:

[[redirects]]
  from = "/.well-known/webfinger"
  to = "https://INSTANCE_NAME/.well-known/webfinger?resource=acct:USER_HANDLE@INSTANCE_NAME"
  status = 200