forked from github/share-post
Fixed Mastodon code
Pls check hashtags variable since I think code is correct but tags are not passed to the web service. Thks!
This commit is contained in:
parent
bcd1ee341b
commit
db31937745
1 changed files with 10 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue