Merge pull request #40 from MiniValine/master

Feat: A simple and minimalist comment system.
This commit is contained in:
沈宇 2020-04-10 16:20:53 +08:00 committed by GitHub
commit 424ace4186
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 72 additions and 5 deletions

View File

@ -101,14 +101,14 @@ layout:
article_width: 80rem article_width: 80rem
sidebar_width: 8rem sidebar_width: 8rem
# 评论1、Valine(推荐)2、Gitalk # 评论1、Valine(推荐)2、Gitalk3、MiniValine
# 1、Valine[一款快速、简洁且高效的无后端评论系统](https://github.com/xCss/Valine) # 1、Valine[一款快速、简洁且高效的无后端评论系统](https://github.com/xCss/Valine)
# 启用Valine必须先创建leancloud应用 获取 id|key 填入即可 # 启用Valine必须先创建leancloud应用 获取 id|key 填入即可
leancloud: leancloud:
enable: true enable: true
app_id: # app_id: # Your leancloud application appid
app_key: # app_key: # Your leancloud application appkey
# Valine配置 # Valine配置
valine: valine:
enable: true # 是否启用 enable: true # 是否启用
@ -126,6 +126,20 @@ gitalk:
owner: # GitHub ID owner: # GitHub ID
admin: # GitHub ID admin: # GitHub ID
# 3、MiniValine
# See: https://github.com/MiniValine/MiniValine
minivaline:
enable: true
placeholder: Write a Comment # Comment box placeholder
adminEmailMd5: # The MD5 of Admin Email to show Admin Flag.
math: true # Support MathJax.
md: true # Support Markdown.
# MiniValine's display language depends on user's browser or system environment
# If you want everyone visiting your site to see a uniform language, you can set a force language value
# Available values: en | zh-CN | (and many more)
# More i18n info: https://github.com/MiniValine/minivaline-i18n
lang:
# GitHub Ribbons-封面右上角的forkme换样式直接在source/images目录下替换forkme图片 # GitHub Ribbons-封面右上角的forkme换样式直接在source/images目录下替换forkme图片
github: github:
# (关闭请设置为false) # (关闭请设置为false)

View File

@ -81,5 +81,9 @@
<% if (is_post()) { %> <% if (is_post()) { %>
<%- partial('post/gitalk') %> <%- partial('post/gitalk') %>
<% } %> <% } %>
<% if (theme.minivaline && theme.minivaline.enable && !post.no_minivaline){ %>
<%- partial('post/minivaline') %>
<% } %>
</article> </article>

View File

@ -0,0 +1,49 @@
<% if (!index && theme.leancloud && theme.leancloud.enable){ %>
<!-- minivaline评论 -->
<div id="mvcomments-box">
<div id="mvcomments">
</div>
</div>
<script src='https://cdn.jsdelivr.net/npm/minivaline/dist/MiniValine.min.js'></script>
<script>
new MiniValine({
el: '#mvcomments',
appId: '<%- theme.leancloud.app_id %>',
appKey: '<%- theme.leancloud.app_key %>',
placeholder: '<%- theme.minivaline.placeholder %>',
lang: '<%- theme.minivaline.lang %>',
adminEmailMd5: '<%- theme.minivaline.adminEmailMd5 %>',
math: <%- theme.minivaline.math %>,
md: <%- theme.minivaline.md %>
});
const infoEle = document.querySelector('#mvcomments .info');
if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
infoEle.childNodes.forEach(function (item) {
item.parentNode.removeChild(item);
});
}
</script>
<style>
#mvcomments-box {
padding: 5px 30px;
}
@media screen and (max-width: 800px) {
#mvcomments-box {
padding: 5px 0px;
}
}
#mvcomments-box #mvcomments {
background-color: #fff;
}
.v .vlist .vcard .vh {
padding-right: 20px;
}
.v .vlist .vcard {
padding-left: 10px;
}
</style>
<% } %>

BIN
logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 KiB

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 89 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 81 KiB