美文网首页
hexo next主题引入valine评论系统

hexo next主题引入valine评论系统

作者: 隔壁老王z | 来源:发表于2022-01-11 17:10 被阅读0次

next5及以下的版本需要手动引入
1、在leancloud获取 APP ID 和 APP KEY
2、在页面中配置

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Valine - A simple comment system based on Leancloud.</title>
    <!--Leancloud 操作库:-->
    <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
    <!--Valine 的核心代码库:-->
    <script src="./dist/Valine.min.js"></script>
</head>
<body>
    <div class="comment"></div>
    <script>
        new Valine({
            // AV 对象来自上面引入av-min.js(老司机们不要开车➳♡゛扎心了老铁)
            av: AV, 
            el: '.comment', // 
            app_id: 'Your APP ID', // 这里填写上面得到的APP ID
            app_key: 'Your APP KEY', // 这里填写上面得到的APP KEY
            placeholder: 'ヾノ≧∀≦)o来啊,快活啊!' // [v1.0.7 new]留言框占位提示文字
        });
    </script>
</body>
</html>

3、登陆leancloud查看所有评论,具体步骤:登录>选择你创建的应用>存储>选择ClassComment

next6以上版本可以通过配置引入

在 theme/next _config.yml文件配置

# Valine
# For more information: https://valine.js.org, https://github.com/xCss/Valine
valine:
  enable: true
  appid: XXX
  appkey: XXX
  notify: true # Mail notifier
  verify: false # Verification code
  placeholder: Just go go # Comment box placeholder
  avatar: monsterid # Gravatar style
  guest_info: nick,mail,link # Custom comment header
  pageSize: 10 # Pagination size
  language: # Language, available values: en, zh-cn
  visitor: true # Article reading statistic
  comment_count: true # If false, comment count will only be displayed in post page, not in home page
  recordIP: false # Whether to record the commenter IP
  serverURLs: # When the custom domain name is enabled, fill it in here (it will be detected automatically by default, no need to fill in)
  #post_meta_order: 0

相关文章

网友评论

      本文标题:hexo next主题引入valine评论系统

      本文链接:https://www.haomeiwen.com/subject/ciabcrtx.html