chore: optimize directory structure

This commit is contained in:
XPoet 2020-10-29 15:42:58 +08:00
parent efe9d9b64b
commit 136359bf00
20 changed files with 66 additions and 64 deletions

View File

@ -188,7 +188,7 @@ rss:
# 评论插件 # 评论插件
# 主题内置了 Valine 和 Gitalk只能使用其中一款。 # 主题内置了 Valine 和 Gitalk只能使用其中一款。
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
comments: comment:
# Valine # Valine
# See: https://github.com/xCss/Valine # See: https://github.com/xCss/Valine
# 如何使用 Valine请参考官方教程https://github.com/xCss/Valine # 如何使用 Valine请参考官方教程https://github.com/xCss/Valine
@ -430,7 +430,7 @@ top: 9999
hexo new page about hexo new page about
``` ```
2. 创建成功后,打开博客目录下 `/source/about/index.md` 文件,即可填写自己的内容。 2. 创建成功后,打开博客目录下 `/source/about/index.md` 文件,即可填写自己的内容。
支持 Markdown 和 HTML 格式;`comments: true` 表示该页面开启评论功能。 支持 Markdown 和 HTML 格式;`comment: true` 表示该页面开启评论功能。
参考如下示例: 参考如下示例:
@ -438,7 +438,7 @@ top: 9999
--- ---
title: about title: about
date: 2020-03-19 14:59:53 date: 2020-03-19 14:59:53
comments: true comment: true
--- ---
## About me ## About me

View File

@ -46,7 +46,7 @@ rss:
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
# Comment plugin # Comment plugin
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
comments: comment:
# Valine # Valine
# See: https://github.com/xCss/Valine # See: https://github.com/xCss/Valine
valine: valine:

View File

@ -15,7 +15,6 @@ tag: Tag
tags: Tags tags: Tags
tagcloud: Tag Cloud tagcloud: Tag Cloud
comment: Comment comment: Comment
comments: Comments
home: Home home: Home
archive: Archive archive: Archive
archives: Archives archives: Archives

View File

@ -14,8 +14,7 @@ categories: 分类
tag: 标签 tag: 标签
tags: 标签 tags: 标签
tagcloud: 标签云 tagcloud: 标签云
comment: 留言 comment: 评论
comments: 评论
home: 首页 home: 首页
archive: 归档 archive: 归档
archives: 归档 archives: 归档

View File

@ -1,10 +1,10 @@
<div class="comments-container"> <div class="comments-container">
<div id="comment-anchor"></div> <div id="comment-anchor"></div>
<% if (theme.comments.valine.enable && theme.comments.gitalk.enable) { %> <% if (theme.comment.valine.enable && theme.comment.gitalk.enable) { %>
<%- partial('valine') %> <%- partial('valine') %>
<% } else if (theme.comments.valine.enable) { %> <% } else if (theme.comment.valine.enable) { %>
<%- partial('valine') %> <%- partial('valine') %>
<% } else if (theme.comments.gitalk.enable) { %> <% } else if (theme.comment.gitalk.enable) { %>
<%- partial('gitalk') %> <%- partial('gitalk') %>
<% } %> <% } %>
</div> </div>

View File

@ -0,0 +1,22 @@
<% if(
theme.comment.gitalk.enable
&& theme.comment.gitalk.client_id
&& theme.comment.gitalk.client_secret
&& theme.comment.gitalk.github_id
&& theme.comment.gitalk.repository
) { %>
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
const gitalk = new Gitalk({
clientID: '<%= theme.comment.gitalk.client_id %>',
clientSecret: '<%= theme.comment.gitalk.client_secret %>',
repo: '<%= theme.comment.gitalk.repository %>',
owner: '<%= theme.comment.gitalk.github_id %>',
admin: ['<%= theme.comment.gitalk.github_id %>'],
id: location.pathname,
language: '<%= config.language %>'
})
gitalk.render('gitalk-container')
</script>
<% } %>

View File

@ -1,7 +1,7 @@
<% if( <% if(
theme.comments.valine.enable theme.comment.valine.enable
&& theme.comments.valine.appid && theme.comment.valine.appid
&& theme.comments.valine.appkey && theme.comment.valine.appkey
) { %> ) { %>
<div class="valine-container"> <div class="valine-container">
<script src='//unpkg.com/valine/dist/Valine.min.js'></script> <script src='//unpkg.com/valine/dist/Valine.min.js'></script>
@ -9,12 +9,12 @@
<script> <script>
new Valine({ new Valine({
el: '#vcomments', el: '#vcomments',
appId: '<%= theme.comments.valine.appid %>', appId: '<%= theme.comment.valine.appid %>',
appKey: '<%= theme.comments.valine.appkey %>', appKey: '<%= theme.comment.valine.appkey %>',
meta: '<%= theme.comments.valine.meta %>'.split(','), meta: '<%= theme.comment.valine.meta %>'.split(','),
avatar: 'wavatar', avatar: 'wavatar',
enableQQ: true, enableQQ: true,
placeholder: '<%= theme.comments.valine.placeholder %>', placeholder: '<%= theme.comment.valine.placeholder %>',
lang: '<%= config.language %>'.toLowerCase() lang: '<%= config.language %>'.toLowerCase()
}); });

View File

@ -1,22 +0,0 @@
<% if(
theme.comments.gitalk.enable
&& theme.comments.gitalk.client_id
&& theme.comments.gitalk.client_secret
&& theme.comments.gitalk.github_id
&& theme.comments.gitalk.repository
) { %>
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
const gitalk = new Gitalk({
clientID: '<%= theme.comments.gitalk.client_id %>',
clientSecret: '<%= theme.comments.gitalk.client_secret %>',
repo: '<%= theme.comments.gitalk.repository %>',
owner: '<%= theme.comments.gitalk.github_id %>',
admin: ['<%= theme.comments.gitalk.github_id %>'],
id: location.pathname,
language: '<%= config.language %>'
})
gitalk.render('gitalk-container')
</script>
<% } %>

View File

@ -22,6 +22,6 @@
<% } %> <% } %>
<% if (theme.toc.enable) { %> <% if (theme.toc.enable) { %>
<%- js(['lib/anime.min.js', 'js/toc.js']) %> <%- js(['js/libs/anime.min.js', 'js/toc.js']) %>
<% } %> <% } %>
<% } %> <% } %>

View File

@ -6,7 +6,7 @@
</li> </li>
<% } %> <% } %>
<% if (is_post() && (theme.comments.valine.enable || theme.comments.gitalk.enable)) { %> <% if (is_post() && (theme.comment.valine.enable || theme.comment.gitalk.enable)) { %>
<li class="go-comment"> <li class="go-comment">
<i class="fa fa-comment"></i> <i class="fa fa-comment"></i>
</li> </li>

View File

@ -4,8 +4,8 @@
<%- page.content %> <%- page.content %>
</div> </div>
<div class="about-comments"> <div class="about-comments">
<% if (page.comments) { %> <% if (page.comment) { %>
<%- partial('_partial/comments/comment') %> <%- partial('_partial/comment/comment') %>
<% } %> <% } %>
</div> </div>
</div> </div>

View File

@ -61,9 +61,9 @@
</div> </div>
<% } %> <% } %>
<% if (theme.comments.valine.enable || theme.comments.gitalk.enable) { %> <% if (theme.comment.valine.enable || theme.comment.gitalk.enable) { %>
<div class="comment-container"> <div class="comment-container">
<%- partial('_partial/comments/comment') %> <%- partial('_partial/comment/comment') %>
</div> </div>
<% } %> <% } %>
</div> </div>

View File

@ -6,8 +6,8 @@
}) %> }) %>
</div> </div>
<div class="category-comments"> <div class="category-comments">
<% if (page.comments) { %> <% if (page.comment) { %>
<%- partial('_partial/comments/comment') %> <%- partial('_partial/comment/comment') %>
<% } %> <% } %>
</div> </div>
</div> </div>

View File

@ -4,8 +4,8 @@
<%- page.content %> <%- page.content %>
</div> </div>
<div class="links-comments"> <div class="links-comments">
<% if (page.comments) { %> <% if (page.comment) { %>
<%- partial('_partial/comments/comment') %> <%- partial('_partial/comment/comment') %>
<% } %> <% } %>
</div> </div>
</div> </div>

View File

@ -0,0 +1,18 @@
if (hexo-config('comment.valine.enable')) {
@require "./valine.styl";
}
if (hexo-config('comment.gitalk.enable')) {
@require "./gitalk.styl";
}
if (hexo-config('comment.valine.enable') && hexo-config('comment.gitalk.enable')) {
@require "./valine.styl";
}
.comments-container {
#comment-anchor {
width: 100%;
height: 20px;
}
}

View File

@ -1,14 +0,0 @@
if (hexo-config('comments.valine.enable')) {
@require "./valine.styl";
}
if (hexo-config('comments.gitalk.enable')) {
@require "./gitalk.styl";
}
.comments-container {
#comment-anchor {
width: 100%;
height: 20px;
}
}

View File

@ -4,7 +4,7 @@
@import "layout/page.styl" @import "layout/page.styl"
@import "layout/_partial/local-search.styl" @import "layout/_partial/local-search.styl"
@import "layout/_partial/toc.styl" @import "layout/_partial/toc.styl"
@import "layout/_partial/comments/comment.styl" @import "layout/_partial/comment/comment.styl"
@import "layout/_partial/header.styl" @import "layout/_partial/header.styl"
@import "layout/_partial/tools.styl" @import "layout/_partial/tools.styl"
@import "layout/_partial/tools2.styl" @import "layout/_partial/tools2.styl"