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

Fix: update valine comment system version and update configuration #1983

Merged
merged 2 commits into from Nov 3, 2017

Conversation

Projects
None yet
3 participants
@xCss
Contributor

xCss commented Nov 3, 2017

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines.
  • Tests for the changes have been added (for bug fixes / features).
    • Muse | Mist have been tested.
    • Pisces | Gemini have been tested.
  • Docs have been added / updated (for bug fixes / features).

PR Type

What kind of change does this PR introduce?

  • Bugfix.
  • Feature.
  • Code style update (formatting, local variables).
  • Refactoring (no functional changes, no api changes).
  • Build related changes.
  • CI related changes.
  • Documentation content changes.
  • Other... Please describe:

What is the current behavior?

Issue Number(s): N/A

What is the new behavior?

Description about this pull, in several words...

  • Screens with this changes: N/A
  • Link to demo site with this changes: N/A

How to use?

In NexT _config.yml:

-# more info please open https://github.com/xCss/Valine
+# more info please open https://valine.js.org
 valine:
   enable: false
   appid:  # your leancloud application appid
   appkey:  # your leancloud application appkey
   notify: false # mail notifier , https://github.com/xCss/Valine/wiki
   verify: false # Verification code
-  placeholder: Comment input placeholder
+  placeholder: Just go go # comment box placeholder
+  avatar: mm # gravatar style
+  guest_info: nick,mail,link # custom comment header
+  pageSize: 10 # pagination size

layout/_macro/post.swig:

+            {% elseif theme.valine.enable and theme.valine.appid and theme.valine.appkey %}
+              <span class="post-comments-count">
+                <span class="post-meta-divider">|</span>
+                <span class="post-meta-item-icon">
+                  <i class="fa fa-comment-o"></i>
+                </span>
+                <a href="{{ url_for(post.path) }}#comments" itemprop="discussionUrl">
+                  <span class="post-comments-count valine-comment-count" data-xid="{{ url_for(post.path) }}" itemprop="commentCount"></span>
+                </a>
+              </span>

layout/_third-party/comments/valine.swig

-{% if page.comments and theme.valine.enable and theme.valine.appid and theme.valine.appkey %}
+<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
+<script src="//unpkg.com/valine/dist/Valine.min.js"></script>
+{% if theme.valine.enable and theme.valine.appid and theme.valine.appkey %}
   
-  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
-  <script src="//cdn.jsdelivr.net/gh/xcss/valine@v1.1.7-rc3/dist/Valine.min.js"></script>
   <script type="text/javascript">
+    var GUEST = ['nick','mail','link'];
+    var guest = '{{ theme.valine.guest_info }}';
+    guest = guest.split(',').filter(item=>{
+      return GUEST.indexOf(item)>-1;
+    });
     new Valine({
-        av: AV,
         el: '#comments' ,
         verify: {{ theme.valine.verify }},
         notify: {{ theme.valine.notify }},
-        app_id: '{{ theme.valine.appid }}',
-        app_key: '{{ theme.valine.appkey }}',
-        placeholder: '{{ theme.valine.placeholder }}'
+        appId: '{{ theme.valine.appid }}',
+        appKey: '{{ theme.valine.appkey }}',
+        placeholder: '{{ theme.valine.placeholder }}',
+        avatar:'{{ theme.valine.avatar }}',
+        guest_info:guest,
+        pageSize:'{{ theme.valine.pageSize }}' || 10,

Does this PR introduce a breaking change?

  • Yes.
  • No.
@@ -64,7 +64,6 @@
{% elseif theme.valine.appid and theme.valine.appkey %}
<div class="comments" id="comments">
<div id="vcomments"></div>

This comment has been minimized.

@ivan-nginx

ivan-nginx Nov 3, 2017

Collaborator

No need apeear comments block on full post here?

@ivan-nginx

ivan-nginx Nov 3, 2017

Collaborator

No need apeear comments block on full post here?

This comment has been minimized.

@xCss

xCss Nov 3, 2017

Contributor

Ok, i got it. thx

@xCss

xCss Nov 3, 2017

Contributor

Ok, i got it. thx

@ivan-nginx ivan-nginx merged commit 6d10ca8 into iissnan:master Nov 3, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
hound No violations found. Woof!

@ivan-nginx ivan-nginx added this to the v5.1.4 milestone Nov 3, 2017

@tingstory

This comment has been minimized.

Show comment
Hide comment
@tingstory

tingstory Jan 1, 2018

是 Markdown 不是 MarkDown

tingstory commented Jan 1, 2018

是 Markdown 不是 MarkDown

@tingstory

This comment has been minimized.

Show comment
Hide comment
@tingstory

tingstory Jan 1, 2018

Error:MarkDown is Support
is Markdown not MarkDown

tingstory commented Jan 1, 2018

Error:MarkDown is Support
is Markdown not MarkDown

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