Jump to content

ActivityPub/Primer/Hashtags

From W3C Wiki

A hashtag is an in-content organizational tool that lets people posting in a social network associate a piece of content with a topic.

Using a Hashtag

The Hashtag link type represents a hashtag. It is not a standard type in the Activity Vocabulary, but is defined in the miscellany extension for ActivityPub.

To associate a content object like a Note or an Image with a hashtag, the tag property is used, referring to the desired hashtag.

An example from the Miscellany extension document:

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    "https://purl.archive.org/miscellany"
  ],
  "id": "https://example.com/notes/1",
  "type": "Note",
  "attributedTo": "https://example.com/users/john",
  "summary": "A thank-you note",
  "content": "<a href='https://example.org/tags/givingthanks'>#givingthanks</a>",
  "tag": [
    {
      "type": "Hashtag",
      "href": "https://example.org/tags/givingthanks",
      "name": "#givingthanks"
    }
  ]
}

Typically, the href value of a Hashtag link object is the URL of a Web page with a stream of content -- notes, images, etc. -- that have a tag property with a reference to that hashtag.

Following Hashtags

Within many ActivityPub implementations, it's possible to locally follow a hashtag. This will put in the actor's inbox any content that is tagged with a hashtag with the same name.

Note that only the content that is delivered to the server platform is sent to the inbox in this way; not all data across the ActivityPub network is always delivered to every server. Local following of hashtags is handled internally by the implementation, and does not use ActivityPub directly.

In order to share public content more widely across the network, ActivityPub ActivityPub/Primer/Relays relays will re-send public information from one server to many others. Some relays, such as fedi.buzz, will filter this stream of public content by hashtag, making it easier to follow the larger conversation.

Finally, a Hashtag object can be given a inbox and outbox property, making it a followable ActivityPub actor in its own right. An example Hashtag as an ActivityPub actor may look like the following:

{
  "@context": [
     "https://www.w3.org/ns/activitystreams",
     "https://purl.archive.org/miscellany"
  ],
  "type": "Hashtag",
  "id": "https://example.org/hashtag/givingthanks",
  "href": "https://example.org/tags/givingthanks",
  "name": "#givingthanks",
  "inbox": "https://example.org/hashtag/givingthanks/inbox",
  "outbox": "https://example.org/hashtag/givingthanks/outbox"
} 

This has a number of problems. First, the Hashtag type is a subtype of the Link type, so it is unusual to have an id or other Object properties. Additionally, some implementations will only allow AS2 actor types, such as Person or Organization to be followed.