为 Octopress 添加多说评论系统
来源:互联网 发布:在淘宝上怎么修改评价 编辑:程序博客网 时间:2024/05/17 08:48
多说( http://duoshuo.com/ )接入流程也不复杂。网上有很多教程,我简单说一下我是如何操作的。
1.获取站点的short_name
到多说的官网注册账号,并且添加你的站点。short_name
就是添加站点的时候的多说域名框里填写的。添加站点流程如下:
2.配置_config.yml
在 _config.yml
中添加
# duoshuo commentsduoshuo_comments: trueduoshuo_short_name: superqq
3.添加多说评论模块
打开文件 source/_layouts/post.html 找到下面这段disqus
代码
{% if site.disqus_short_name and page.comments == true %} <section> <h1>Comments</h1> <div id="disqus_thread" aria-live="polite">{% include post/disqus_thread.html %}</div> </section>{% endif %}
在下面增加:
{% if site.duoshuo_short_name and site.duoshuo_comments == true and page.comments == true %} <section> <h1>Comments</h1> <div id="comments" aria-live="polite">{% include post/duoshuo.html %}</div> </section>{% endif %}
4.创建duoshuo.html
创建一个source/_includes/post/duoshuo.html,里面实现代码如下:
<!-- Duoshuo Comment BEGIN --><div class="ds-thread" data-title="{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}"></div><script type="text/javascript"> var duoshuoQuery = {short_name:"{{ site.duoshuo_short_name }}"}; (function() { var ds = document.createElement('script'); ds.type = 'text/javascript';ds.async = true; ds.src = 'http://static.duoshuo.com/embed.js'; ds.charset = 'UTF-8'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ds); })();</script><!-- Duoshuo Comment END -->
5.配置article.html
打开文件 _includes/article.html 文件,在
{% if site.disqus_short_name and page.comments != false and post.comments != false and site.disqus_show_comment_count == true %} | <a href="{% if index %}{{ root_url }}{{ post.url }}{% endif %}#disqus_thread">Comments</a> {% endif %}
在下面增加:
{% if site.duoshuo_short_name and page.comments != false and post.comments != false and site.duoshuo_comments == true %} | <a href="{% if index %}{{ root_url }}{{ post.url }}{% endif %}#comments">Comments</a> {% endif %}
0 0
- 为 Octopress 添加多说评论系统
- 为Next主题添加多说评论系统
- 多说 评论系统
- 为Hexo添加多说评论功能(正文评论和列表评论数)
- 为Hexo添加多说评论功能(正文评论和列表评论数)
- Hexo 添加多说评论
- Octopress侧边栏及评论系统定制
- 为octopress添加tag Cloud
- 给博客添加多说评论
- python django 添加多说评论框
- jekyll中使用多说评论系统
- Hexo中使用多说评论系统
- Hexo中使用多说评论系统
- 如何给Ghost博客添加多说评论
- 多说评论嵌套
- 多说评论插件
- Jekyll 多说评论
- 如何在django使用多说评论系统
- C语言的数组初始化
- 找工作知识储备(3)---从头说12种排序算法:原理、图解、动画视频演示、代码以及笔试面试题目中的应用
- 窗口函数的学习 windows的基础上(windows内部函数)
- 快速排序
- 递归的四大法则
- 为 Octopress 添加多说评论系统
- 互联网公司对Android,iOS开发工程师的职位要求
- java环境变量配置
- JavaScript 事件顺序:冒泡和捕获
- 求二叉树节点的最大距离
- JavaScript 和事件
- stopPropagation, preventDefault 和 return false 的区别
- Bubbling and capturing
- Four ways to deal with private members in JavaScript