I want to set a social link at the end of my post in the Django template. how to use social media link in Django's post for sharing my posts in the social?
Asked
Active
Viewed 1.7k times
3
-
1Use a token for your social share HTML and add that to the context when rendering the page. When writing the method which returns the HTML, keep in mind what you need to use for the social sharing link in order to make it work. Normally you pass the page URL, I believe. – 2rs2ts Jan 31 '14 at 14:04
2 Answers
12
Check out django-social-share (https://github.com/fcurella/django-social-share) or django-socialsharing (https://github.com/lettertwo/django-socialsharing).
More can be found here: https://www.djangopackages.com/grids/g/social/

wendy_winter
- 531
- 3
- 11
-
5The first 2 links are very useful, with the second one, django-socialsharing, being a really complete django social share app (you can share almost to anywhere), although based on the external services provided by [AddThis](http://www.addthis.com). The last link, instead, provides a useful list of social-related django apps available to the public, but the listed apps have nothing related to sharing: they provide social networks integrations in other ways: for example external authentication with social networks accounts or features like "invite your friends". Anyway thanks from me too! – valleymanbs May 10 '14 at 22:48
-
1[django-addthis](https://github.com/raymondwanyoike/django-addthis) is a cleaned-up implementation of `django-socialsharing` and installed easily via pip: ```pip install django-addthis``` - Give it a try! – Peterino Jul 07 '14 at 10:24
-
Here another app: [`django-social-widgets`](https://github.com/creafz/django-social-widgets), although currently `django-social-share` seems to be the best maintained one. – J0ANMM Dec 22 '17 at 13:18
-
4
I found somethings. For Google, Linkedin, Facebook:
<a href="https://plus.google.com/share?url=http://your-domain{{ request.get_full_path|urlencode }}"></a>
<a href="http://www.linkedin.com/shareArticle?url=http://your-domain{{ request.get_full_path|urlencode }}&title=<your title>&summary=<your desc>&source=http://your-domain"></a>
<a href="http://www.facebook.com/sharer/sharer.php?u=http://your-domain{{ request.get_full_path|urlencode }}"></a>
Also, this plugin (django-social-share) is very nice. You can install it by:
pip install django-social-share
For using this plugin see the Doc's page

Ali Hallaji
- 3,712
- 2
- 29
- 36