Getting the user's Mastodon-compatible username

I want to include this in the metadata.
I see mastodon in the parameters but it’s for the cross post mapping.

For example, I have in my settings and in my mapping.

Is this property exposed and I’m just not searching for it properly?

No, I don’t think the ActivityPub (Mastodon-compatible) username is exposed in Hugo templates, unfortunately. It is public information, however, so, in theory, you could fetch it from the user’s profile page using resources.GetRemote and findRE.

But that is a bit of a hack and would slow down builds. Hopefully, @manton will consider exposing the ActivityPub username to Hugo templates instead.

You can just add it to your config as a site level custom param. For example, this is my site’s config.json:

  "markup": {
    "highlight": {
      "anchorLineNos": false,
      "codeFences": true,
      "guessSyntax": true,
      "hl_Lines": "",
      "lineAnchors": "",
      "lineNoStart": 1,
      "lineNos": true,
      "lineNumbersInTable": true,
      "noClasses": true,
      "style": "dracula",
      "tabWidth": 4
    "goldmark": {
      "renderer": {
        "unsafe": true
  "params": {
    "twitter_username": "jsonbecker",
    "github_username": "jsonbecker",
    "instagram_username": "jsonbecker",
    "mastodon_url": "",
    "bookshop_affiliate_id": "9011",
    "contact": "",
    "menu": [
        "name": "Now",
        "url": "/categories/now"
        "name": "Books",
        "url": "/books"
        "name": "Photos",
        "url": "/categories/photoblogging"
         "name": "Archive",
         "url": "/archive"

Then you can use things like .Site.Params.github_username to access in a template.

I’ll add it as a default parameter too.


Thank you.

Sometimes, I feel like an edge case for some of this stuff. I don’t want to ask for a change that is more work than it’s worth.

Please don’t hesitate to mention stuff like this that is missing. Sometimes it’s on purpose but often just an oversight, like in this case of the ActivityPub username. I’ll get it added within the next couple of days. Thanks!