New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增对Valine评论系统的支持 #646

Open
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
@xCss

xCss commented Oct 29, 2017

新增对Valine评论系统的支持

_config.yml

#6、Valine https://valine.js.org
valine: 
 appid:  #Leancloud应用的appId
 appkey:  #Leancloud应用的appKey
 verify: false #验证码
 notify: false #评论回复提醒
 avatar: mm #评论列表头像样式:''/mm/identicon/monsterid/wavatar/retro/hide
 placeholder: Just go go #评论框占位符

layout/_partial/article.ejs

  <% if (theme.valine && theme.valine.appid && theme.valine.appkey){ %>
    <section id="comments" style="margin:10px;padding:10px;background:#fff;">
      <%- partial('post/valine', {
        key: post.slug,
        title: post.title,
        url: config.url+url_for(post.path)
        }) %>
    </section>
  <% } %>
<% } %>

layout/_partial/post/valine.ejs

<div id="vcomment" class="comment"></div> 
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="//unpkg.com/valine/dist/Valine.min.js"></script>
<script>
   var notify = '<%= theme.valine.notify %>' == true ? true : false;
   var verify = '<%= theme.valine.verify %>' == true ? true : false;
    window.onload = function() {
        new Valine({
            el: '.comment',
            notify: notify,
            verify: verify,
            app_id: "<%= theme.valine.appid %>",
            app_key: "<%= theme.valine.appkey %>",
            placeholder: "<%= theme.valine.placeholder %>",
            avatar:"<%= theme.valine.avatar %>"
        });
    }
</script>

yilia

@donk3yzz

This comment has been minimized.

donk3yzz commented Dec 6, 2017

你好,我在博客中开启了valine,但是有一篇文章下评论块出现在了文章中间使我不得不关闭了评论块,对此毫无办法...

@xCss

This comment has been minimized.

xCss commented Dec 6, 2017

@donk3yzz 你好,你可以尝试性的将layout/_partial/post/valine.ejs文件中的

        new Valine({
            el: '.comment',
            ...
        });

修改成:

        new Valine({
            el: '#vcomment',
            ...
        });

以上,祝好~

@donk3yzz

This comment has been minimized.

donk3yzz commented Dec 6, 2017

@xCss 起作用了!感谢!
不过我还有一个问题,为什么我在本地hexo server的页面上加载评论就很快,而在域名上评论块就加载的很慢甚至经常加载不出来...

@xCss

This comment has been minimized.

xCss commented Dec 6, 2017

@donk3yzz 我看你貌似是某些图片加载比较慢。你可以尝试性的将layout/_partial/post/valine.ejs中的

    window.onload = function() {
        new Valine({
            el: '#vcomment',
            notify: notify,
            verify: verify,
            app_id: "<%= theme.valine.appid %>",
            app_key: "<%= theme.valine.appkey %>",
            placeholder: "<%= theme.valine.placeholder %>",
            avatar:"<%= theme.valine.avatar %>"
        });
    }

改成

        new Valine({
            el: '#vcomment',
            notify: notify,
            verify: verify,
            app_id: "<%= theme.valine.appid %>",
            app_key: "<%= theme.valine.appkey %>",
            placeholder: "<%= theme.valine.placeholder %>",
            avatar:"<%= theme.valine.avatar %>"
        });

只是尝试,不确定是否有用~~

@donk3yzz

This comment has been minimized.

donk3yzz commented Dec 6, 2017

@xCss 也解决了~虽然浏览器小图标还是一直在转...不过还是非常感谢你

@deepred5

This comment has been minimized.

deepred5 commented Apr 5, 2018

支持

@MonoLogueChi

This comment has been minimized.

MonoLogueChi commented Apr 9, 2018

改成了响应式布局,宽度应该能够自动和上面的文章部分对齐

<% if (theme.valine && theme.valine.appid && theme.valine.appkey){ %>
    <section id="comments" class="comments">
      <style>
        .comments{margin:30px;padding:10px;background:#fff}
        @media screen and (max-width:800px){.comments{margin:auto;padding:10px;background:#fff}}
      </style>
      <%- partial('post/valine', {
        key: post.slug,
        title: post.title,
        url: config.url+url_for(post.path)
        }) %>
  </section>
<% } %>

电脑(宽屏)
image

手机(窄屏)
image

具体样式可以看https://www.xxwhite.com/2017/Valine.html

@shangzekai

This comment has been minimized.

shangzekai commented May 2, 2018

@xCss 您好,按照您上面的步骤操作了一下,但是网站没有任何反应 ,也没有报错,不知道啥原因。www.shangzekai.xyz这个是我的网站

@xCss

This comment has been minimized.

xCss commented May 2, 2018

@shangzekai ,我这看到的是显示了的。有可能是你的网络问题。
screencapture-shangzekai-xyz-2018-03-06-yaf-e6-a8-a1-e5-9e-8b-2018-05-02-17_00_30

@shangzekai

This comment has been minimized.

shangzekai commented May 2, 2018

@xCss 谢谢您 还有就是https://shangzekai.leanapp.cn/ 这个怎么登录呢 _User表中的数据为空

@xCss

This comment has been minimized.

xCss commented May 2, 2018

@shangzekai
参考 https://panjunwen.com/diy-a-comment-system/

LeanCloud控制面板:存储-你的数据库-user表-添加行-输入email、用户名、密码等必要信息-完成。这样就能访问评论管理了。

-by @panjunwen

@liuchunming033

只有部署到网上,才能看到评论系统吗。。本地调试时是否可以看到呢?我现在本地调试看不到评论框

@liuchunming033

This comment has been minimized.

liuchunming033 commented May 8, 2018

_config.yml这里说的_config.yml是主题目录下的文件还是博客根目录下的文件

@startower

This comment has been minimized.

startower commented May 15, 2018

为什么我的评论系统不仅在进入博文后显示,还在主页的每一篇博文下面显示?怎么修改?
我的博客:www.startowerblog.com

@xCss

This comment has been minimized.

xCss commented May 15, 2018

@startower 这很明显是你改错了模板。

没有源码,暂不确定是你改错了哪里~

@startower

This comment has been minimized.

startower commented May 15, 2018

@xCss 尴尬,代码放错位置了

@xCss xCss referenced this pull request Jul 17, 2018

Closed

请求适配Smackdown主题 #103

@Brycexxx

This comment has been minimized.

Brycexxx commented Aug 27, 2018

请问各位,我的评论系统也在主页出现了,确定代码位置什么的都没放错,实在不知道问题出在哪里

@saranfeishuang

This comment has been minimized.

saranfeishuang commented Aug 27, 2018

@Brycexxx 把article.ejs里的Valine评论系统代码往上移动一些,移到<% if (!index && post.comments){ %>下面试试

@Brycexxx

This comment has been minimized.

Brycexxx commented Aug 27, 2018

@saranfeishuang
多谢啦,还是我太菜了,你这么一说感觉恍然大悟

@saranfeishuang

This comment has been minimized.

saranfeishuang commented Aug 27, 2018

@Brycexxx “关于我”那里,请问您是怎么换行的,我输入换行符后会自动把
的<>转义掉

@Brycexxx

This comment has been minimized.

Brycexxx commented Aug 27, 2018

@saranfeishuang
我就是用了<br>,没其他的了

@saranfeishuang

This comment has been minimized.

saranfeishuang commented Aug 27, 2018

@Brycexxx 好吧,谢谢

@Brycexxx

This comment has been minimized.

Brycexxx commented Aug 27, 2018

@saranfeishuang
客气了

@caozhengbo

This comment has been minimized.

caozhengbo commented Oct 9, 2018

问题1:Code -1: Request has been terminated
Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.
问题2:在哪里调试这个对话框的大小布局

@dondurma

This comment has been minimized.

dondurma commented Nov 26, 2018

这个配置能同样适用于yelee主题吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment