python django 添加多说评论框
来源:互联网 发布:矩阵分解含义 编辑:程序博客网 时间:2024/05/21 10:15
一口气写了三篇,趁还记得起来吧,一步一个脚印的感觉也不错,当初想个一口气实现很多功能,倒让自己有点不知道从何开始。
纪录下如何去添加多说评论框,首先需要去多说注册个账号:link
注册好了后,多说会提供一段js代码了,如下:
<!-- 多说评论框 start --> <div class="ds-thread" data-thread-key="{{ article.id }}" data-title="{{ article.title }}" data-url="{{ article.get_absolute_url }}"></div><!-- 多说评论框 end --><!-- 多说公共JS代码 start (一个网页只需插入一次) --><script type="text/javascript">var duoshuoQuery = {short_name:"gululu"}; (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><!-- 多说公共JS代码 end -->
以上要注意的地方主要就是,那三个标签参数和short_name(也就是在多说创建的那个账号)
关于参数article已经很明显,就是需要加评论的那篇文章了.
好了,将多说提供的这段代码保存在templates下面,供别处引用,姑且叫个duoshuo.html的名字。如何引用呢?
{% extends "base.html" %} {% load custom_markdown %} {% block custom_styles %}<link href="/static/blog/css/monokai.css" rel="stylesheet">{% endblock %} {% block title %}{{ article.title }}{% endblock title %} {% block content %}<h1>{{ article.title }}</h1><div id="main"> {{ article.content | custom_markdown }}</div>{% include "duoshuo.html" %}{% endblock content %}引用处就在最后两行了,看看效果。
0 0
- python django 添加多说评论框
- Hexo 添加多说评论
- Django博客开发(九)—添加多说评论和JS日历
- 为 Octopress 添加多说评论系统
- 给博客添加多说评论
- 如何在django使用多说评论系统
- 为Hexo添加多说评论功能(正文评论和列表评论数)
- 为Hexo添加多说评论功能(正文评论和列表评论数)
- 如何给Ghost博客添加多说评论
- 为Next主题添加多说评论系统
- 多说评论嵌套
- 多说评论插件
- 多说 评论系统
- Jekyll 多说评论
- 多说评论常用代码
- [wordpress插件推荐]多说社会化评论框
- woocommerce中商品页面添加多说评论通用代码配置教程
- Hexo站点优化更换主题添加多说评论增加百度统计
- Instanceof和泛型
- Graveyard
- 《浪潮之巅》读后感
- today_tomorrow 深度学习概述:从感知机到深度网络
- Android线程间通信之Handler
- python django 添加多说评论框
- @RenderBody、@RenderSection、@RenderPage、Html.RenderPartial、Html.RenderAction的作用和区别
- 新闻推荐系统之朴素贝叶斯分类器文本分类
- 自动更新覆盖安装的模板代码
- 第一个network的代码实现基于mnist数据集
- ServletContext域对象和资源路径读取问题
- leetcode349: Intersection of Two Arrays
- codeforces-337【C思维,贪心】
- 洛谷1120小木棍