Bladeren bron

share_post: add share-to-Diaspora* support

This uses the sharetodiaspora.github.io HTML5 posting app, necessary due
to Diaspora*'s multi-homed nature.
Giel van Schijndel 10 jaren geleden
bovenliggende
commit
b0e6993e8a
2 gewijzigde bestanden met toevoegingen van 6 en 1 verwijderingen
  1. 2 0
      share_post/README.md
  2. 4 1
      share_post/share_post.py

+ 2 - 0
share_post/README.md

@@ -51,6 +51,8 @@ Template Example
 <section>
     <p id="post-share-links">
         Share on:
+        <a href="{{article.share_post['diaspora']}}" target="_blank" title="Share on Diaspora">Diaspora*</a>
+        ❄
         <a href="{{article.share_post['twitter']}}" target="_blank" title="Share on Twitter">Twitter</a>
         <a href="{{article.share_post['facebook']}}" target="_blank" title="Share on Facebook">Facebook</a>

+ 4 - 1
share_post/share_post.py

@@ -39,12 +39,15 @@ def share_post(content):
     summary = article_summary(content)
 
     tweet = ('%s%s%s' % (title, quote(' '), url)).encode('utf-8')
+    diaspora_link = 'https://sharetodiaspora.github.io/?title=%s&url=%s' % (title, url)
     facebook_link = 'http://www.facebook.com/sharer/sharer.php?s=100&amp;p%%5Burl%%5D=%s' % url
     gplus_link = 'https://plus.google.com/share?url=%s' % url
     twitter_link = 'http://twitter.com/home?status=%s' % tweet
     mail_link = 'mailto:?subject=%s&amp;body=%s' % (title, url)
 
-    share_links = {'twitter': twitter_link,
+    share_links = {
+                   'diaspora': diaspora_link,
+                   'twitter': twitter_link,
                    'facebook': facebook_link,
                    'google-plus': gplus_link,
                    'email': mail_link