发现使用disqus带来的评论很少,而这个不是自己想看的,那样的话还不如自带的评论,虽然不是很强大,但是也够。
试着用过搜狐的畅言,但是有太多的问题,文档也有问题,不够强大。。。所说的强大是指,不够简单。
虽然说多说没有disqus强大,但是至少他做到了适合国人评论,至少在xunta的时候是那样。这里只是简单的替换,不过我觉得这样应该也就够了。
这是默认的Disqus的代码
{% load disqus_tags %}
而多说的代码是这样的。
div class='ds-thread' data-thread-key='请将此处替换成文章在你的站点中的ID' data-title='请替换成文章的标题' data-url='请替换成文章的网址'>div> script type='text/javascript'> var duoshuoQuery = {short_name:'geekslife'}; (function() { var ds = document.createElement('script'); ds.type = 'text/javascript';ds.async = true; ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js'; ds.charset = 'UTF-8'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ds); })(); script>
我们只需要拿出
data-url data-title
便可以完成基本的分享与评论,和这个可以从上面的disqus中拿到
var disqus_url = 'http{% if request.is_secure %}s{% endif %}://{{ request.META.HTTP_HOST }}{{ object_for_comments.get_absolute_url }}'; var disqus_title = '{{ object_for_comments|escapejs }}'; var disqus_identifier = '{% disqus_id_for object_for_comments %}';
最后代码如下所示
div class='ds-thread' data-thread-key=''{% disqus_id_for object_for_comments %}' data-title=''{{ object_for_comments|escapejs }}' data-url='http{% if request.is_secure %}s{% endif %}://{{ request.META.HTTP_HOST }}{{ object_for_comments.get_absolute_url }}'>div> script type='text/javascript'> var duoshuoQuery = {short_name:'geeks'}; (function() { var ds = document.createElement('script'); ds.type = 'text/javascript';ds.async = true; ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js'; ds.charset = 'UTF-8'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ds); })(); script>
联系客服