多说关闭,这是一个对 yelee 主题做畅言社会化评论支持的临时解决方案。

已知问题,会导致当点击评论条等区域时再加载评论模块这个功能失效。

过程

1.修改文件 \themes\yelee\layout\_partial\comments\duoshuo.ejs 为如下内容,并重命名为 changyan.ejs。

<!--PC 和 WAP 自适应版-->
<div id="SOHUCS" ></div>
<script type="text/javascript">
(function(){
var appid = '<%=appid%>';
var conf = '<%=conf%>';
var width = window.innerWidth || document.documentElement.clientWidth;
if (width < 960) {
window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="//changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("//changyan.sohu.com/upload/changyan.js",function(){window.changyan.api.config({appid:appid,conf:conf})}); } })(); </script>

2.修改\themes\yelee\layout\_partial\article.ejs,把原来多说位置的代码改为:

<% if (theme.changyan.on) { %>
  <%- partial('comments/changyan', {
      appid: theme.changyan.appid,
      conf: theme.changyan.conf
      }) %>

3.修改样式文件\themes\yelee\source\css\_partial\main.styl,查找 duoshou,替换为如下样式:

#SOHUCS {
    padding: 0 40px !important;
    width: inherit !important;
}

4.3.修改样式文件\themes\yelee\source\css\_partial\mobile.styl,查找 duoshou,替换为如下样式:

#SOHUCS {
padding: 0 13px;
}

4.将 _config.yml 中 duoshuo 的部分修改为:

changyan:
on: on
appid: <与通用接入代码中的 appid 对应>
conf: <与通用接入代码中的 conf 对应>