From a06b3dbf4e89895552943c68c19cae009e3af0e6 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Wed, 3 Apr 2019 14:54:26 +0800 Subject: [PATCH] update --- _config.yml | 7 +++---- layout/_partial/meta.ejs | 2 +- layout/_partial/side.ejs | 30 +++++++++++++++++++++-------- layout/_third-party/clipboard.ejs | 2 +- layout/_third-party/share.ejs | 2 +- layout/_widget/related_posts.ejs | 2 +- layout/_widget/square.ejs | 24 +++++++++++++++++++++++ layout/_widget/toc.ejs | 2 +- layout/index.ejs | 3 +-- layout/layout.ejs | 2 +- layout/list.ejs | 32 +++++++++++++++++++++++++++++++ source/less/_base.less | 6 +++++- source/less/_side.less | 2 +- 13 files changed, 94 insertions(+), 22 deletions(-) create mode 100755 layout/_widget/square.ejs create mode 100755 layout/list.ejs diff --git a/_config.yml b/_config.yml index 00cef74..23fed42 100755 --- a/_config.yml +++ b/_config.yml @@ -19,12 +19,10 @@ services: nodewaves: true busuanzi: true # fastclick: true - # popular_posts: true # 需要安装插件 hexo-related-popular-posts comments: true volantis: true # music: true # share: true - # qrcode: true # 需要安装插件 npm i -S hexo-helper-qrcode ############################### 默认值 ############################### @@ -108,7 +106,7 @@ sidebar: avatar: https://cdn.jsdelivr.net/gh/xaoxuu/assets@master/avatar/avatar.png social: true - widget: toc - - widget: list + - widget: square icon: fas fa-map-signs title: 站内导航 rows: @@ -142,7 +140,7 @@ sidebar: more: icon: fas fa-expand-arrows-alt url: blog/tags/ - - widget: related_posts + - widget: related_posts # 需要安装插件 npm i -S hexo-related-popular-posts - widget: music icon: fas fa-compact-disc title: "最近在听" @@ -165,6 +163,7 @@ social: url: https://music.163.com/#/user/home?id=63035382 # 分享按钮 +# 当id为qrcode时需要安装插件 npm i -S hexo-helper-qrcode share: - id: qq name: QQ好友 diff --git a/layout/_partial/meta.ejs b/layout/_partial/meta.ejs index c8631e5..6b0ac7a 100644 --- a/layout/_partial/meta.ejs +++ b/layout/_partial/meta.ejs @@ -1,4 +1,4 @@ -<% if(is_home() || is_category() || is_archive() || is_tag()) { +<% if(is_home() || is_category() || is_archive() || is_tag() || page.index) { var isPostList = true; } else { var isPostList = false; diff --git a/layout/_partial/side.ejs b/layout/_partial/side.ejs index ddc256e..05258f9 100755 --- a/layout/_partial/side.ejs +++ b/layout/_partial/side.ejs @@ -1,15 +1,29 @@ diff --git a/layout/_third-party/clipboard.ejs b/layout/_third-party/clipboard.ejs index a1b24e2..ec1df04 100644 --- a/layout/_third-party/clipboard.ejs +++ b/layout/_third-party/clipboard.ejs @@ -8,7 +8,7 @@ var initCopyCode = function(){ var copyHtml = ''; copyHtml += ''; $(".highlight .code pre").before(copyHtml); var clipboard = new ClipboardJS('.btn-copy', { diff --git a/layout/_third-party/share.ejs b/layout/_third-party/share.ejs index 20a37e7..acfe350 100644 --- a/layout/_third-party/share.ejs +++ b/layout/_third-party/share.ejs @@ -3,7 +3,7 @@
<% (theme.share||[]).forEach(function(item){ %> - <% if (item.id == 'qrcode' && theme.services.qrcode == true){ %> + <% if (item.id == 'qrcode'){ %> <% if (item.img){ %> diff --git a/layout/_widget/related_posts.ejs b/layout/_widget/related_posts.ejs index b0ea295..7c9d7c0 100755 --- a/layout/_widget/related_posts.ejs +++ b/layout/_widget/related_posts.ejs @@ -1,4 +1,4 @@ -<% if(theme.services && theme.services.popular_posts == true && page.layout == 'post' && page.content && page.path){ %> +<% if(page.layout == 'post' && page.content && page.path){ %>
<%- partial('header', {item: item, defIcon: 'fas fa-bookmark', defTitle: __('sidebar.related_posts')}) %>
diff --git a/layout/_widget/square.ejs b/layout/_widget/square.ejs new file mode 100755 index 0000000..a8000e0 --- /dev/null +++ b/layout/_widget/square.ejs @@ -0,0 +1,24 @@ +
+ <%- partial('header', {item: item, defIcon: '', defTitle: ''}) %> + +
diff --git a/layout/_widget/toc.ejs b/layout/_widget/toc.ejs index 214c97b..bb9e79c 100755 --- a/layout/_widget/toc.ejs +++ b/layout/_widget/toc.ejs @@ -1,4 +1,4 @@ -<% if(page.layout == 'post' && page.content && page.toc!==false && toc(page.content).length > 0){ %> +<% if(page.layout == 'post' && page.content && toc(page.content).length > 0){ %>
<%- partial('header', {item: item, defIcon: 'fas fa-list', defTitle: __('sidebar.toc')}) %>
diff --git a/layout/index.ejs b/layout/index.ejs index 7f6f396..4f1d429 100755 --- a/layout/index.ejs +++ b/layout/index.ejs @@ -1,4 +1,3 @@ - <% if (page.prev == 0) { %>
@@ -44,7 +43,7 @@ <%- partial('_partial/header', null, {cache: !config.relative_link, path: path}) %> <% } %>
-
+
<%- partial('_partial/archive') %>
diff --git a/layout/layout.ejs b/layout/layout.ejs index 0bf274e..daa1a7b 100755 --- a/layout/layout.ejs +++ b/layout/layout.ejs @@ -7,7 +7,7 @@ <% } else { %> <%- partial('_partial/header', null, {cache: !config.relative_link, path: path}) %>
-
+
<%- body %>
diff --git a/layout/list.ejs b/layout/list.ejs new file mode 100755 index 0000000..2e72eb5 --- /dev/null +++ b/layout/list.ejs @@ -0,0 +1,32 @@ +
+ <% if (site.posts && site.posts.length > 0) { %> +
+ <% site.posts.each(function(p){ %> + <% if (p.type == page.type) { %> +
+ <%- partial('_partial/post', {post: p, index: false}) %> +
+ <% } %> + <% }) %> +
+ <% if (page && page.posts) { %> + + <% + var need_mathjax = false; + page.posts.each(function(post){ + if (post.mathjax){ + if (post.mathjax != "internal") { + need_mathjax = true; + } + } + }); + %> + <% if (need_mathjax){ %> + <%- partial('mathjax') %> + <% } %> + + <% } %> + <% } %> +
+<%- partial('_partial/side') %> +<%- partial('_partial/footer', null, {cache: !config.relative_link}) %> diff --git a/source/less/_base.less b/source/less/_base.less index eb8a38e..12f4e72 100755 --- a/source/less/_base.less +++ b/source/less/_base.less @@ -451,11 +451,15 @@ ul.h-list { } } -.container { +.body-wrapper { position: relative; + display: flex; width: 100%; max-width: @width_container; margin: 0 auto; + flex-wrap: wrap; + justify-content: space-between; + align-items: stretch; } .container--flex { diff --git a/source/less/_side.less b/source/less/_side.less index 60ec74b..4034669 100755 --- a/source/less/_side.less +++ b/source/less/_side.less @@ -223,7 +223,7 @@ } } - &.list{ + &.list, &.square{ .content{ padding: @gap/2 0; &.pure{