Creating Share Buttons for Twitter, Facebook, and Linkedin using Django Templatetags

It's easy to copy and paste urls to share links, but its easier to just click on a button to do it. The way I decided to do it was to write a custom django templatetag. The template tag exists in myproject/myapp/templatetags/sharebuttons.py. You can use the pre-built template here Usage in a template:

{% load sharebuttons %}

{% for p in posts %}
   {% sharebutton p "twitter" %}
{% sharebutton p "facebook" %}
{% sharebutton p "linkedin" %}
{% endfor %}
Tagged as django , share social
Written by Andrew Konkol on August 22nd, 2011

0 Comments

Log in with Twitter, Google, Facebook, LinkedIn to leave a comment.