From 89d1f123e8094245d11aaceb926ab05fffcac430 Mon Sep 17 00:00:00 2001 From: Maurizio Paglia Date: Mon, 5 Dec 2022 12:05:40 +0100 Subject: [PATCH] Added Mastodon share code --- pelican/plugins/share_post/share_post.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index f30b088..2942389 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -54,6 +54,13 @@ def create_link_diaspora(title, url, content): def create_link_facebook(title, url, content): return f"https://www.facebook.com/sharer/sharer.php?u={url}" +@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}" + @create_link def create_link_twitter(title, url, content):