wzpan / hexo-theme-freemind

Most powerful bootstrap theme for hexo.

Home Page:http://hahack.com/hexo-theme-freemind-blog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

请教作者如何使用云跟帖替代新逝的多说?

opened this issue · comments

多说最近官宣死掉了, 请问作者大大如何使用云跟帖进行替代?

观察到作者自己的blog貌似已经使用云跟帖。

谢谢

方法差不多,到网易云跟帖里头注册个账户,然后获取Web代码。

一份web代码差不多长这样:

<div id="cloud-tie-wrapper" class="cloud-tie-wrapper"></div>
<script src="https://img1.cache.netease.com/f2e/tie/yun/sdk/loader.js"></script>
<script>
var cloudTieConfig = {
  url: document.location.href, 
  sourceId: "",
  productKey: "你的product_key",
  target: "cloud-tie-wrapper"
};
var yunManualLoad = true;
Tie.loader("aHR0cHM6Ly9hcGkuZ2VudGllLjE2My5jb20vcGMvbGl2ZXNjcmlwdC5odG1s", true);
</script>

将一行的代码放进主题的 layout/_partial/post/comment.ejs 里头,你可以写成类似这样:

<% if (cache && page.comment){ %>
<section id="comment">
  <h2 class="title"><%= __('comment') %></h2>

  <% if(theme.duoshuo_shortname) { %>
  	 <div class="ds-thread" data-title="<%= page.title %>"></div>  
  <% } else if(config.disqus_shortname) { %>
  <div id="disqus_thread">
    <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  </div>
  <% } else if (theme.gentie_key) { %>
  	 <div id="cloud-tie-wrapper" class="cloud-tie-wrapper"></div>
  <% } %>
</section>
<% } %>

后面的内容则放到主题的 layout/_partial/after_footer.ejs 里头,类似这样:

<% if (theme.duoshuo_shortname) { %>
<script type="text/javascript">
  var duoshuoQuery = { short_name: '<%= theme.duoshuo_shortname %>' };
  (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>
<% } else if (config.disqus_shortname){ %>
<script type="text/javascript">
var disqus_shortname = '<%= config.disqus_shortname %>';

(function(){
  var dsq = document.createElement('script');
  dsq.type = 'text/javascript';
  dsq.async = true;
  dsq.src = '//' + disqus_shortname + '.disqus.com/<% if (page.comments){ %>embed.js<% } else { %>count.js<% } %>';
  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}());
</script>
<% } else if (theme.gentie_key) {%>  
	 <script src="https://img1.cache.netease.com/f2e/tie/yun/sdk/loader.js"></script>
	 <script>
	 	var cloudTieConfig = {
  	  	url: document.location.href, 
  	  	sourceId: "",
  	  	productKey: "<%= theme.gentie_key %>",
  	  	target: "cloud-tie-wrapper"
};
		var yunManualLoad = true;
		Tie.loader("aHR0cHM6Ly9hcGkuZ2VudGllLjE2My5jb20vcGMvbGl2ZXNjcmlwdC5odG1s", true);
	</script> 
<% } %>

完成后,在主题的 _config.yml 里头配一个 gentie_key 即可。

gentie_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

FYI, 我已经放弃使用网易云跟贴,而是搭了个 isso

那请问, isso怎么在这个主题中使用?

首先要有服务器。然后照着官网教程安装配置。

关于isso的问题请移步该项目提问,关闭本issue。