i18n
xaoxuu 5 years ago
parent bd9bd1470c
commit 93d56c11b5
  1. 5
      _config.yml
  2. 11
      layout/_third-party/comments.ejs
  3. 4
      layout/_third-party/popular_posts.ejs
  4. 7
      source/less/_main.less

@ -8,7 +8,7 @@ info:
name: Material X name: Material X
docs: https://xaoxuu.com/wiki/material-x/ docs: https://xaoxuu.com/wiki/material-x/
# 主题的CDN地址。如需启用CDN,请在主目录的config中设置,详见文档。 # 主题的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 busuanzi: true
# fastclick: true # fastclick: true
# leancloud_visitors: 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 comments: true
volantis: true volantis: true
music: true music: true

@ -1,6 +1,7 @@
<!-- 显示推荐文章和评论 --> <!-- 显示推荐文章和评论 -->
<% <%
var displayRecommentedPosts = false; var displayRecommentedPosts = false;
var displayPopularPosts = false;
var displayComments = false; var displayComments = false;
if (page && theme.services) { 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) { 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) { if ((config.disqus_shortname || config.livere_uid || config.valine) && theme.services.comments == true && page.comments != false) {
displayComments = true; displayComments = true;
} }
if (theme.services.popular_posts == true) {
displayPopularPosts = true;
}
} }
%> %>
<% if (displayRecommentedPosts || displayComments) { %> <% if (displayRecommentedPosts || displayPopularPosts || displayComments) { %>
<article class="post white-box comments"> <article class="post white-box comments">
<section class="article typo"> <section class="article typo">
<% if (displayRecommentedPosts) { %> <% if (displayRecommentedPosts) { %>
<%- partial('recommended_posts', {page: page, site: site}) %> <%- partial('recommended_posts', {page: page, site: site}) %>
<% } %> <% } %>
<% if (displayPopularPosts) { %>
<%- partial('popular_posts', {page: page, site: site}) %>
<% } %>
<% if (displayComments) { %> <% if (displayComments) { %>
<h4><i class="fas fa-comments fa-fw" aria-hidden="true"></i>&nbsp;<%- __('post.comments') %></h4> <h4><i class="fas fa-comments fa-fw" aria-hidden="true"></i>&nbsp;<%- __('post.comments') %></h4>
<% if (config.disqus_shortname) { %> <% if (config.disqus_shortname) { %>

@ -0,0 +1,4 @@
<div class="recommended_posts">
<h4><i class="fas fa-bookmark fa-fw" aria-hidden="true"></i>&nbsp;<%- __('post.related_posts') %></h4>
<%- popular_posts( {} , post ) %>
</div>

@ -18,6 +18,13 @@
margin: 0; margin: 0;
} }
} }
ul.popular-posts{
h3{
padding: 0;
margin: 0;
font-size: @fontsize_base;
}
}
#comments { #comments {
position: relative; position: relative;
// padding-top: 1.5*@gap; // padding-top: 1.5*@gap;

Loading…
Cancel
Save