0

如何将社交共享功能添加到我在 Django 中构建的网站。我在 SO 中看到了一个类似的问题,但这并没有帮助(下面我解释了为什么?),这是 6 年前提出的,我认为这些年后可能必须有更好的方法来做到这一点。

我尝试使用addthis,它优雅且易于使用,但这是我在 Facebook 上分享帖子时的问题。

在此处输入图像描述

而且它也没有记录分享帖子的数量。

我还尝试了其他我不理解或无法正常工作的方法。请帮我做这件事。非常感谢。

编辑:我收到此错误。添加后<a href="https://www.facebook.com/sharer/sharer.php?u={{ request.get_full_path|urlencode }}&t={{ object.title }}">Share on Facebook</a>

在此处输入图像描述

4

1 回答 1

1

将其用于 Facebook: {% with base_url="http://example.com" %} <a href="https://www.facebook.com/sharer/sharer.php?u={{ base_url|urlencode }}{{ request.get_full_path|urlencode }}&t={{ object.title }}">Share on Facebook</a> {% endwith %}

对于推特: {% with base_url="http://example.com" %} <a href="https://twitter.com/share?text={{ user.username }}&url={{ base_url|urlencode }}{{ request.get_full_path|urlencode}}">Share on Twitter</a> {% endwith %}

对于Linkedin:使用这个

于 2019-05-27T16:26:45.957 回答