Formally defining a Hashtag type?

mastodon implemented the Hashtag type within the as: namespace, though it doesn’t exist in the activitystreams context. it is not formally defined anywhere. the closest thing to that is this section: ActivityPub - Mastodon documentation

it would be nice to have input in formalizing a definition for Hashtag or some similar concept via FEP, and maybe take this opportunity to align implementations on how it should function. there are some open points of confusion:

  • as mentioned above: should it be formally adopted into the activitystreams context?
  • what type is it and what properties can it have?
    • some implementations (Hubzilla, formerly?) treat it as a subtype of Object, with an id
    • some implementations (Mastodon) treat it as a subtype of Link, with an href
    • some implementations (several?) ignore the id/href entirely and identify/dedupe hashtags by name
      • even then, implementations differ on whether the name should start with the hash or not (#hashtag vs hashtag)
      • furthermore, it is unclear if implementations place further restrictions upon hashtags or their name. which characters are allowed in a hashtag, and which ones terminate it? are there any character limits? can it be defined by a regex?
  • should it even be called a Hashtag? do we maintain the hash at all? do we come up with some other name for it, like Tag or Taxonomy? see also the above point about whether name should start with a hash or not.

there are also possible extensions:

  • a visual icon that can be displayed before the hashtag. twitter has done something similar before, giving certain trending hashtags their own visual flair or emoji.

things to keep an eye on:

  • different types of tags, such as “cashtags” starting with a dollar sign (“cash” or $), or “bangtags” starting with an exclamation point (“bang” or !), may or may not overlap with the semantics of a Hashtag despite not actually being “hashtags”. this should be explored.
4 Likes

If I recall, the spec insisted it have an id. The spec also included the hash character in the name. In recent work I’ve added a type of ‘Hashtag’. Forgot what namespace I pretended it was in. I did recently add ‘href’ for the sake of Mastodon compatibility even though it’s using the wrong object model. So basically fetching id will fetch the ActivityPub tag Collection and href returns an HTML page. This is probably the reason for the different implementations. Hashtag searches aren’t universally available as ActivityPub Collections, but rather as HTML links on most projects. Eventually I’ll move the ‘href’ to a Link under ‘url’ for correctness. But I doubt Mastodon will look for it there. Then again, I don’t even know if they can find it now.

We also use Hashtag for bangtags - we just set the name = ‘!something’. In this case, you can determine the proper context by the tag character. We weren’t too worried about compatibility since there are only a couple of projects that are even aware of bangtags. Cashtags are even rarer. We use these internally but they currently don’t federate.

This one really needs to be resolved at the spec level.

Also (slightly off topic) one of the Place/location fields (elevation?) seems to have the wrong subclass if you compare with the rest of Place/location fields. I forget which, but one of them was obviously wrong.

“They’re more what you’d call guidelines, than actual rules” - Captain Barbarossa

1 Like