Giter Club home page Giter Club logo

Comments (5)

BruceZhaoR avatar BruceZhaoR commented on June 8, 2024

@lianghuiyuan
这是官方说明文档:

<!-- 多说评论框 start -->
     <div class="ds-thread" 
        data-thread-key="请将此处替换成文章在你的站点中的ID" 
        data-title="请替换成文章的标题" 
        data-url="请替换成文章的网址">
     </div>
<!-- 多说评论框 end -->

我的做法如下,另外还增加了一个热评文章链接:

 {% if site.duoshuo_username %}
 <!-- 多说评论框 start -->
 <div class="comment">
        <div class="ds-thread"
               data-thread-key="{{page.id}}"
               data-title="{{page.title}}"
               data-url="{{site.url}}{{site.BASE_PATH}}{{page.url}}" >
         </div>
                <!-- 多说热评文章 end -->
        <div class="ds-top-threads" data-range="monthly" data-num-items="5"></div>
   </div>
<!-- 多说评论框 end -->
 {% endif %}

注意:我这里的 site.BASE_PATH 是自己的定义的变量,等同于模板里面的site.baseurl.

关于 data-thread-key 看这里解释 http://dev.duoshuo.com/docs/5003ecd94cab3e7250000008
关于 page.id 看这里:http://jekyllcn.com/docs/variables/
于是的每篇文章的thread-key都不会相同,方便了以后评论迁移及管理。
你可以可以参考我的blog 欢迎评论测试。http://brucezhaor.github.io

下面是多说后台管理,我理解的thread-key就是每篇文章的唯一标识,不知道是否正确,还请高人指正。

data-thread-key

希望能够帮助你。:smile:

from huxpro.github.io.

lianghuiyuan avatar lianghuiyuan commented on June 8, 2024

@BruceZhaoR 如问题中描述的,data-thread-id="1187623191091085319"这个data-thread-id是什么ID呢,如何获取?

from huxpro.github.io.

Huxpro avatar Huxpro commented on June 8, 2024

@lianghuiyuan

由于当时多说数据库迁移的问题,我的评论有部分丢失,所以使用 id 强行索引回来的。
你并不需要使用这个 id,正常情况下,使用 key 就可以与其它文章区分了

关于 data-thread-key, 具体可以参见 @BruceZhaoR 的回答~(感谢 @BruceZhaoR

from huxpro.github.io.

BruceZhaoR avatar BruceZhaoR commented on June 8, 2024

请仔细你看我的回答和下面的 多说 官方链接-关于thread-key的。反正我的方法是能用的,Hux的ID我也不清楚怎么来的,你可以发邮件问他。

From BruceZhao's iPhone.
在2016年01月21日 21:52,Mr.L 写道:

@BruceZhaoR 如问题中描述的,data-thread-id="1187623191091085319"这个data-thread-id是什么ID呢,如何获取?


Reply to this email directly or view it on GitHub.

from huxpro.github.io.

lianghuiyuan avatar lianghuiyuan commented on June 8, 2024

Ok, 明白了,非常感谢两位解答。 @BruceZhaoR @Huxpro

from huxpro.github.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.