From db31937745a24701e026715a230ed3fb46fde4f8 Mon Sep 17 00:00:00 2001 From: Maurizio Paglia Date: Wed, 28 Dec 2022 11:39:26 +0100 Subject: [PATCH] Fixed Mastodon code Pls check hashtags variable since I think code is correct but tags are not passed to the web service. Thks! --- pelican/plugins/share_post/share_post.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index 35deb80..c6a8abb 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -57,10 +57,16 @@ def create_link_facebook(title, url, content): @create_link def create_link_mastodon(title, url, content): - tags = getattr(content, "tags", []) - tags = ", ".join([tag.slug for tag in tags]) - hashtags = f"&hashtags={tags}" if tags else "" - return f"https://toot.kytta.dev/?text={title}&url={url}{hashtags}" + if hasattr(content, 'tags'): + taglist = content.tags + new_taglist = [] + for i in taglist: + new_taglist.append('#' + str(i)) + hashtags = ' '.join(str(x).replace(" ", "") for x in new_taglist) + else: + hashtags = '' + + return f"https://toot.kytta.dev/?text={title}{newline}{url}{newline}{hashtags}" @create_link