From 93d56c11b5ef78efa25e560149185da669f45894 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Mon, 11 Feb 2019 17:41:48 +0800 Subject: [PATCH] update --- _config.yml | 5 +++-- layout/_third-party/comments.ejs | 11 ++++++++--- layout/_third-party/popular_posts.ejs | 4 ++++ source/less/_main.less | 7 +++++++ 4 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 layout/_third-party/popular_posts.ejs diff --git a/_config.yml b/_config.yml index 4be786f..8fd5fd5 100755 --- a/_config.yml +++ b/_config.yml @@ -8,7 +8,7 @@ info: name: Material X docs: https://xaoxuu.com/wiki/material-x/ # 主题的CDN地址。如需启用CDN,请在主目录的config中设置,详见文档。 - cdn: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.1.18/ + cdn: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.2.11/ ############################### 主题样式 ############################### @@ -26,7 +26,8 @@ services: busuanzi: true # fastclick: true # leancloud_visitors: true - recommended_posts: true # 需要安装插件 hexo-recommended-posts + # recommended_posts: true # 需要安装插件 hexo-recommended-posts + popular_posts: true # 需要安装插件 hexo-related-popular-posts comments: true volantis: true music: true diff --git a/layout/_third-party/comments.ejs b/layout/_third-party/comments.ejs index 33923db..0bf3fbb 100644 --- a/layout/_third-party/comments.ejs +++ b/layout/_third-party/comments.ejs @@ -1,6 +1,7 @@ <% var displayRecommentedPosts = false; + var displayPopularPosts = false; var displayComments = false; if (page && theme.services) { if (theme.services.recommended_posts == true && theme.recommended_posts && theme.recommended_posts.autoDisplay == false && page.layout == 'post' && page.recommended_posts != false) { @@ -9,17 +10,21 @@ if ((config.disqus_shortname || config.livere_uid || config.valine) && theme.services.comments == true && page.comments != false) { displayComments = true; } + if (theme.services.popular_posts == true) { + displayPopularPosts = true; + } } %> -<% if (displayRecommentedPosts || displayComments) { %> +<% if (displayRecommentedPosts || displayPopularPosts || displayComments) { %>
- <% if (displayRecommentedPosts) { %> <%- partial('recommended_posts', {page: page, site: site}) %> <% } %> - + <% if (displayPopularPosts) { %> + <%- partial('popular_posts', {page: page, site: site}) %> + <% } %> <% if (displayComments) { %>

 <%- __('post.comments') %>

<% if (config.disqus_shortname) { %> diff --git a/layout/_third-party/popular_posts.ejs b/layout/_third-party/popular_posts.ejs new file mode 100644 index 0000000..c15a0e4 --- /dev/null +++ b/layout/_third-party/popular_posts.ejs @@ -0,0 +1,4 @@ + diff --git a/source/less/_main.less b/source/less/_main.less index e97aaf6..22090de 100755 --- a/source/less/_main.less +++ b/source/less/_main.less @@ -18,6 +18,13 @@ margin: 0; } } + ul.popular-posts{ + h3{ + padding: 0; + margin: 0; + font-size: @fontsize_base; + } + } #comments { position: relative; // padding-top: 1.5*@gap;