Add a comment system to Hexo

Source: Internet
Author: User
Tags disqus in domain

Default Theme Landscape

File directory, comments for new

--_partial- - Article.ejs |-Comments-- Disqus.ejs |- Duoshuo.ejs |-Youyan.ejs

Registration Comment System:

Disqus Registration Settings ShortName

More say do not register directly login (for example, with Baidu account), set the domain name

Friend register, view ID

1 Modify the Theme Profile Landscape/_config.yml add the following:

# >>> conments Comment System <<<# chose one as your comment system and keep others disable.# selected as a Web site commenting systems, others remain disabled. Disqus:on:trueShortname:yourshortname # https://help.disqus.com/customer/en/portal/articles/466208-what-s-a-shortname-# It's unnecessary to enable Disqusif# you have set"Disqus_shortname" inchYour site'S "_config.yml"Duoshuo: #on:trueDomain:yourdomain # Whether to open comments, http://duoshuo.com/create-site/# Use the above URL to login to your multi-say, and then create a site, in domain to fill in the domain name you set # http://you say the domain name more. duoshuo.comYouyan: #on:true  ID: Yourid # whether to open a friend comment, http://www.uyan.cc/index.php#IDfill in your friend say user digital ID, register and go back to manage to see # Friends of the service in the WEB environment, normal local environment can not be viewed, please deploy and test online. # >>> <<<

2 Modifying Article.ejs additions:

<%if(!index && post.comments) {%> <%if(Theme.duoshuo.on) {%> <%-partial ('Comments/duoshuo', {key:post.path, title:post.title, Url:config.url+url_for (Post.path),}) %> <%}Else if(Theme.youyan.on) {%> <%-partial ('Comments/youyan')%> <%}Else if(Theme.disqus.on) {%> <%-partial ('Comments/disqus', {shortname:theme.disqus.shortname})%> <%}Else if(Config.disqus_shortname) {%> <%-partial ('Comments/disqus', {shortname:config.disqus_shortname})%> <%}%><%}%>

3 new 3 files in comments directory: Disqus.ejs, Duoshuo.ejs, Youyuan.ejs

# Disqus.ejs
<sectionID="Comments"> <divID="Disqus_thread"></div> <script type="Text/javascript">/** * CONFIGURATION variables:edit before PASTING into YOUR webpage * **/var disqus_shortname='<%= shortname%>';//Required:replace example with your forum ShortName /** * DON ' T EDIT BELOW this line * **/ (function() {var dsq= Document.createelement ('Script'); Dsq.type ='Text/javascript'; Dsq.async =true; DSQ.SRC='//'+ Disqus_shortname +'. Disqus.com/embed.js'; (document.getElementsByTagName ('Head')[0] || document.getElementsByTagName ('Body')[0]). appendchild (DSQ); })(); </script> <noscript>please enable JavaScript to view the <a href="Https://disqus.com/?ref_noscript">comments Powered by Disqus.</a></noscript></section>
# Duoshuo.ejs
<div class="Duoshuo" ID="Comments"> <!--comment box start--<div class="Ds-thread"data-thread-key="<%=key%>"data-title="<%=title%>"Data-url="<%=url%>"></div> <!--comment Box End---<!--say public JS code start (one page only needs to be inserted once)--<script type="Text/javascript">var duoshuoquery= {short_name:"<%=theme.duoshuo.domain%>"}; (function() {var ds= Document.createelement ('Script'); Ds.type='Text/javascript';d S.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> <!--more say public JS code end--></div>
# Youyuan.ejs
<section class="Youyan"id="comments"> id="uyan_frame"></div> <script src=" http://v2.uyan.cc/code/uyan.js?uid=<%= theme.youyan.id%>"></script></section >

Configuration complete, you can freely choose to use a review system! The effect is as follows:

Add a comment system to Hexo

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.