diff --git a/_config.yml b/_config.yml
index 2bf4001..183db64 100755
--- a/_config.yml
+++ b/_config.yml
@@ -211,6 +211,10 @@ meta:
# 文章浏览计数
counter:
icon: fas fa-eye
+ # 文章评论数量:只支持 valine
+ valinecount:
+ icon: fal fa-comment-lines
+ desc: '条评论'
# 文章字数和阅读时长
wordcount:
icon_wordcount: fas fa-keyboard
@@ -487,7 +491,7 @@ comments:
valine:
appId: dogUA2FSKGTo029M1SEwGROT-MdYXbMMI # your appId
appKey: u0NdtQ8nvHoMdJPSYqm1LRxE # your appKey
- js: https://cdn.jsdelivr.net/npm/valine@1.4/dist/Valine.min.js
+ js:
path: # All pages use the same path (share the same comments data)
meta: nick,mail,link # valine comment header info
requiredFields: ['nick','mail']
@@ -574,7 +578,7 @@ comments:
search:
enable: true
service: hexo # hexo, google, algolia, azure, baidu
- js: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-volantis@2.6.5/js/search.js
+ # js: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-volantis@2.6.4/js/search.js
google:
apiKey:
engineId:
diff --git a/layout/_meta/author.ejs b/layout/_meta/author.ejs
index 34fca3d..5fd8ce2 100755
--- a/layout/_meta/author.ejs
+++ b/layout/_meta/author.ejs
@@ -5,7 +5,7 @@ if (post.author == undefined) {
%>
diff --git a/layout/_meta/valinecount.ejs b/layout/_meta/valinecount.ejs
new file mode 100644
index 0000000..744b04a
--- /dev/null
+++ b/layout/_meta/valinecount.ejs
@@ -0,0 +1,15 @@
+<% if (theme.comments.valine && theme.comments.valine.appId){ %>
+
+<% } %>
diff --git a/layout/_partial/article.ejs b/layout/_partial/article.ejs
index 92d0c67..6d8b98d 100755
--- a/layout/_partial/article.ejs
+++ b/layout/_partial/article.ejs
@@ -58,11 +58,3 @@
<%- partial('../_third-party/mathjax') %>
<% } %>
-<% if (page.layout == 'post' && page.title){ %>
-
-<% } %>
diff --git a/layout/_partial/cover.ejs b/layout/_partial/cover.ejs
index da9d13f..dfaaae9 100644
--- a/layout/_partial/cover.ejs
+++ b/layout/_partial/cover.ejs
@@ -1,17 +1,18 @@
-<% if (page.cover == true) { %>
-
- <% if (is_home() && page.prev == 0 && theme.cover.scheme == 'docs') { %>
-
- <%- partial('../_cover/index') %>
-
-
- <% } else { %>
-
- <%- partial('../_cover/index') %>
-
- <% } %>
- <%- partial('header', null, {cache: false, path: path}) %>
-
-<% } else { %>
+<%
+var enableCover = false; // 封面是否开启
+if(theme.cover && theme.cover.scheme) {
+ enableCover = true;
+}
+%>
+
+<% if (enableCover) { %>
+
+
+ <%- partial('../_cover/index') %>
+
+
+ <%- partial('header', null, {cache: false, path: path}) %>
+
+<% } else { %>
<%- partial('header', null, {cache: false, path: path}) %>
<% } %>
diff --git a/layout/_partial/footer.ejs b/layout/_partial/footer.ejs
index 6b7d2bc..1fbeee8 100755
--- a/layout/_partial/footer.ejs
+++ b/layout/_partial/footer.ejs
@@ -46,4 +46,3 @@
<% }) %>
<% } %>
-
diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs
index fcc1e23..9737ba2 100755
--- a/layout/_partial/head.ejs
+++ b/layout/_partial/head.ejs
@@ -62,12 +62,17 @@
}
}
%>
- <% if (title) { %><%= title %> - <% } %><%= config.title %>
+ <% if (title) { %><%= title %> - <% } %><%= config.title %>
<% if (keywords){ %>
+ <% } else { %>
+
<% } %>
+
<% if (description){ %>
+ <% } else { %>
+
<% } %>
@@ -85,13 +90,13 @@
<%- css('https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css') %>
-
+
<% if (theme.plugins.nodewaves && theme.plugins.nodewaves.css) { %>
<%- css(theme.plugins.nodewaves.css) %>
<% } %>
<% if (config.favicon) { %>
-
+
<% } %>
<% if (theme.plugins.aplayer.enable) { %>
@@ -119,11 +124,7 @@
<%- css('css/style.css') %>
<% } %>
-
+
<% if (config.google_analytics_key) { %>
diff --git a/layout/_partial/header.ejs b/layout/_partial/header.ejs
index 98a91a8..7acb356 100755
--- a/layout/_partial/header.ejs
+++ b/layout/_partial/header.ejs
@@ -1,5 +1,5 @@
-
-
diff --git a/layout/_partial/scripts.ejs b/layout/_partial/scripts.ejs
index 3fcf8dc..81b4ea9 100755
--- a/layout/_partial/scripts.ejs
+++ b/layout/_partial/scripts.ejs
@@ -1,4 +1,6 @@
<%- js('https://cdn.jsdelivr.net/npm/jquery@3.4/dist/jquery.min.js') %>
+<%- js('https://cdn.jsdelivr.net/npm/pjax@0.2.8/pjax.min.js') %>
+
<% if (theme.search && theme.search.enable) { %>
<% } %>
+
<% if (theme.plugins.instant_page) { %>
-
-<% } %>
-<% if (theme.plugins.scrollreveal && theme.plugins.scrollreveal.js) { %>
-
-
-<% } %>
-<% if (theme.plugins.nodewaves && theme.plugins.nodewaves.js) { %>
- <%- js({src: theme.plugins.nodewaves.js}) %>
-
-<% } %>
-<% if (theme.plugins.busuanzi) { %>
-
+
<% } %>
<% if (theme.plugins.backstretch && theme.plugins.backstretch.enable && (theme.plugins.backstretch.images || page.images)) { %>
@@ -105,6 +79,7 @@
<% }) %>
<% } %>
+
<%
var enableDisqus = false;
var enableLivere = false;
@@ -112,7 +87,7 @@
var enableVssue = false;
var enableValine = false;
var enableMiniValine = false;
- if (theme.comments && page && page.comments == true) {
+ if (theme.comments) {
if (theme.comments.disqus && theme.comments.disqus.shortname) {
enableDisqus = true;
}
@@ -132,10 +107,8 @@
enableMiniValine = true;
}
}
- if (theme.comments.valine && theme.comments.valine.appId && theme.comments.valine.visitor && (theme.layout.on_list.meta.indexOf('counter') > -1)) {
- enableValine = true;
- }
%>
+
<% if (enableDisqus){ %>
<% } %>
-
<% if (enableValine){ %>
<% if (theme.comments.valine.js) { %>
<%- js(theme.comments.valine.js) %>
@@ -214,59 +186,63 @@
<%- js(['js/valine.js']) %>
<% } %>
<% } %>
-
<% if (enableMiniValine){ %>
<% if (theme.comments.minivaline.js) { %>
<%- js(theme.comments.minivaline.js) %>
@@ -308,14 +284,68 @@
<% } %>
+
+<% if (theme.plugins.clipboard && (theme.style.body.highlight.copy_btn == true)) { %>
+ <%- partial('_third-party/clipboard') %>
+<% } %>
+
+
+<% if (theme.plugins.scrollreveal && theme.plugins.scrollreveal.js) { %>
+
+
+<% } %>
+
+
+
+<%- partial('_third-party/fancybox') %>
+
+
<% if (config.use_cdn && theme.info.cdn && theme.info.cdn.js) { %>
<%- js(theme.info.cdn.js) %>
<% } else { %>
<%- js(['js/app.js']) %>
<% } %>
-<% if (theme.search && theme.search.enable && theme.search.js) { %>
- <%- js(theme.search.js) %>
+
+<% if (theme.search && theme.search.enable) { %>
+ <% if (theme.search.js) { %>
+ <%- js(theme.search.js) %>
+ <% } else { %>
+ <%- js(['js/search.js']) %>
+ <% } %>
+<% } %>
+
+<% if (theme.plugins.busuanzi) { %>
+
<% } %>
+
+<% if (theme.plugins.nodewaves && theme.plugins.nodewaves.js) { %>
+ <%- js({src: theme.plugins.nodewaves.js}) %>
+
+<% } %>
+
<% if (theme.plugins.comment_typing) { %>
<%- js(theme.plugins.comment_typing) %>
<% } %>
@@ -327,17 +357,73 @@
<% } %>
<% } %>
-
-
-<% if (theme.plugins.clipboard && (theme.style.body.highlight.copy_btn == true)) { %>
- <%- partial('_third-party/clipboard') %>
-<% } %>
-
-
-
-<%- partial('_third-party/fancybox') %>
-
<% if (config.import && config.import.script){ %>
<% (config.import.script||[]).forEach(function(item){ %>
<%- item %><% }) %>
<% } %>
+
+<%- js(['js/message.js']) %>
+
+
\ No newline at end of file
diff --git a/layout/_third-party/clipboard.ejs b/layout/_third-party/clipboard.ejs
index fce9e37..0cf135f 100644
--- a/layout/_third-party/clipboard.ejs
+++ b/layout/_third-party/clipboard.ejs
@@ -1,54 +1,53 @@
+
+ function pjax_initCopyCode() {
+ var copyHtml = '';
+ copyHtml += '';
+ $(".highlight .code pre").before(copyHtml);
+ $(".article pre code").before(copyHtml);
+ var clipboard = new ClipboardJS('.btn-copy', {
+ target: function (trigger) {
+ return trigger.nextElementSibling
+ }
+ });
+ clipboard.on('success', function (e) {
+ let $btn = $(e.trigger);
+ $btn.addClass('copied');
+ let $icon = $($btn.find('i'));
+ $icon.removeClass('fa-copy');
+ $icon.addClass('fa-check-circle');
+ let $span = $($btn.find('span'));
+ $span[0].innerText = 'COPIED';
+ wait(function () {
+ $icon.removeClass('fa-check-circle');
+ $icon.addClass('fa-copy');
+ $span[0].innerText = 'COPY'
+ }, 2000)
+ });
+ clipboard.on('error', function (e) {
+ e.clearSelection();
+ let $btn = $(e.trigger);
+ $btn.addClass('copy-failed');
+ let $icon = $($btn.find('i'));
+ $icon.removeClass('fa-copy');
+ $icon.addClass('fa-times-circle');
+ let $span = $($btn.find('span'));
+ $span[0].innerText = 'COPY FAILED';
+ wait(function () {
+ $icon.removeClass('fa-times-circle');
+ $icon.addClass('fa-copy');
+ $span[0].innerText = 'COPY'
+ }, 2000)
+ })
+ }
+ $(function () {
+ pjax_initCopyCode()
+ });
+
\ No newline at end of file
diff --git a/layout/_third-party/fancybox.ejs b/layout/_third-party/fancybox.ejs
index 7b3711d..8f02f58 100644
--- a/layout/_third-party/fancybox.ejs
+++ b/layout/_third-party/fancybox.ejs
@@ -10,7 +10,7 @@
}
$(element).attr("data-fancybox", "images");
var caption = ""; // 描述信息
- if ($(this).attr('alt')) { // 标准 markdown 描述信息
+ if ($(this).attr('alt')) { // 判断当前页面是否存在描述信息
$(element).attr('data-caption', $(this).attr('alt'));
caption = $(this).attr('alt');
}
diff --git a/layout/_third-party/pjaxdata.ejs b/layout/_third-party/pjaxdata.ejs
new file mode 100644
index 0000000..d7bc949
--- /dev/null
+++ b/layout/_third-party/pjaxdata.ejs
@@ -0,0 +1,78 @@
+
+
+
+<%
+var changeValinePath = 'none'; // 自定义的 valine 评论路径
+var changeValinePlaceholder = 'none'; // 自定义的 valine 评论描述
+var ispage = false; // 一二级导航栏切换控制
+var postTitle = ''; // 当前文章标题,用于二级导航栏赋值
+var enableCover = false; // 封面是否开启
+var frontMatterCover = 'none'; // 封面控制
+
+var enableValine = false;
+if (theme.comments && page && page.comments == true && theme.comments.valine && theme.comments.valine.appId) {
+ enableValine = true;
+}
+
+if (page && page.comments == true) {
+ if (enableValine && page.valine && page.valine.path) {
+ changeValinePath = page.valine.path;
+ }
+ if (enableValine && page.valine && page.valine.placeholder) {
+ changeValinePlaceholder = page.valine.placeholder;
+ }
+}
+
+if(theme.cover && theme.cover.scheme) {
+ enableCover = true;
+}
+
+if (enableCover && page && page.cover) {
+ frontMatterCover = page.cover;
+ if (is_home() && page.prev == 0 && theme.cover.scheme == 'docs') {
+ frontMatterCover = 'docs';
+ } else {
+ frontMatterCover = 'blog';
+ }
+}
+
+if (page && page.layout == 'post' && page.title) {
+ ispage = true;
+ postTitle = page.title;
+}
+
+%>
+
+
+
<%=ispage%>
+
<%=postTitle%>
+
<%=enableCover%>
+ <% if (enableValine){ %>
+
<%=changeValinePath%>
+
<%=changeValinePlaceholder%>
+ <% } %>
+
+
+<% if (enableCover) { %>
+
+<% } %>
\ No newline at end of file
diff --git a/layout/layout.ejs b/layout/layout.ejs
index b8ad40f..7769373 100755
--- a/layout/layout.ejs
+++ b/layout/layout.ejs
@@ -4,13 +4,14 @@
<%- partial('_partial/cover') %>
-
+
+ <%- partial('_third-party/pjaxdata') %>
<%- body %>
-
- <%- partial('_partial/scripts') %>
-
+
+ <%- partial('_partial/scripts') %>
+