From 5c68e93dfe6517df973cc1ab3c752ed4f72ddf60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A1tia=20Nakamura?= <katia@kiwi.com> Date: Sat, 21 Jul 2018 22:38:15 +0200 Subject: [PATCH] news: add fb/twitter share buttons --- pyconbalkan/news/templates/post.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pyconbalkan/news/templates/post.html b/pyconbalkan/news/templates/post.html index 50ba0ae5..595937bc 100644 --- a/pyconbalkan/news/templates/post.html +++ b/pyconbalkan/news/templates/post.html @@ -1,6 +1,15 @@ {% extends "base.html" %} {% block main_content %} + <div id="fb-root"></div> + <script>(function(d, s, id) { + var js, fjs = d.getElementsByTagName(s)[0]; + if (d.getElementById(id)) return; + js = d.createElement(s); js.id = id; + js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.0'; + fjs.parentNode.insertBefore(js, fjs); + }(document, 'script', 'facebook-jssdk'));</script> + <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> {# Post #} @@ -14,6 +23,9 @@ <h1>{{ post.title }}</h1> {{ post.text|safe }} </p> <h2>Posted by <a href="{% url 'organizer_detail' slug=organizer.slug %}">{{ organizer.user.first_name }} {{ organizer.user.last_name }}</a></h2> + <div class="fb-share-button" data-href="{% url 'post_detail' slug=post.slug %}" data-layout="button_count" data-size="large" data-mobile-iframe="true" style="padding-bottom: 10px"><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fplugins%2F&src=sdkpreparse" class="fb-xfbml-parse-ignore">Share</a></div> + <div><a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-show-count="false" data-size="large" style="padding-bottom: 10px">Tweet</a></div> + </div> </div>