From be54842ce6f22253d37cdde661a328d822fb11a4 Mon Sep 17 00:00:00 2001 From: Ryan Barrett Date: Tue, 14 Mar 2023 15:36:18 -0700 Subject: [PATCH] docs for hashtags #45 --- activitypub.py | 11 ++++++----- templates/docs.html | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/activitypub.py b/activitypub.py index 8836981..7c42ee9 100644 --- a/activitypub.py +++ b/activitypub.py @@ -388,12 +388,13 @@ def postprocess_as2(activity, *, user=None, target=None, create=True): # hashtags. Mastodon requires: # * type: Hashtag # * name starts with # - # * href is set to a valid URL (doesn't matter which) + # * href is set to a valid, fully qualified URL # - # If content has an tag with the hashtag name as its text, Mastodon will - # rewrite its href to the local instance's search for that hashtag. If - # content doesn't have a link for a hashtag, Mastodon won't add one, but the - # hashtag will still be indexed in search. + # If content has an tag with a fully qualified URL and the hashtag name + # (with leading #) as its text, Mastodon will rewrite its href to the local + # instance's search for that hashtag. If content doesn't have a link for a + # given hashtag, Mastodon won't add one, but that hashtag will still be + # indexed in search. # # https://docs.joinmastodon.org/spec/activitypub/#properties-used # https://github.com/snarfed/bridgy-fed/issues/45 diff --git a/templates/docs.html b/templates/docs.html index 12feabd..9e5d1eb 100644 --- a/templates/docs.html +++ b/templates/docs.html @@ -48,6 +48,7 @@ Bridgy Fed takes some technical know-how to set up, and there are simpler (but l
  • How do I follow someone?
  • How do I unfollow someone?
  • How do I include an image in a post?
  • +
  • How do I use hashtags?
  • How do I edit an existing post?
  • Can I publish just one part of a page?
  • How do fediverse replies, likes, and other interactions show up on my site?
  • @@ -327,6 +328,23 @@ I love scotch. Scotchy scotchy scotch.

    +
  • How do I use hashtags?
  • +
  • +

    Use p-category and link the hashtag to a fully qualified URL. (Any URL you want!) Fediverse sites like Mastodon will generally rewrite the link to point to a search for that hashtag on the local instance. For example: + +

    <div class="h-entry">
    +  <p class="e-content">
    +    just setting up my feddr
    +    <a href="https://mysite.com/tag/throwback" class="p-category">#throwback</a>
    +  </p>
    +</div>
    +
    +

    + +

    The leading # character on the hashtag text is optional. If you don't include the hashtag in e-content, or include it but not inside an <a> link, fediverse sites won't add the hashtag text or link themselves, but your post will still be indexed in searches for that hashtag. +

    +
  • +
  • How do I edit an existing post?
  • Edit the post on your web site, then send another webmention to Bridgy Fed for it. Bridgy Fed will refetch the post and send an Update activity for it to the fediverse.