From 5ec82ca8016283495561fb2383d49cf136783db3 Mon Sep 17 00:00:00 2001 From: Jerry Date: Wed, 24 Feb 2021 20:42:26 +0800 Subject: [PATCH] =?UTF-8?q?Breaking=20Change:=20=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E5=AD=90=E7=9B=AE=E9=8C=84=E7=9A=84=E5=AF=AB=E6=B3=95=EF=BC=8C?= =?UTF-8?q?=E8=88=87=E7=88=B6=E7=9B=AE=E9=8C=84=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 2 +- layout/includes/header/menu_item.pug | 12 ++++++------ layout/includes/header/nav.pug | 2 +- layout/includes/sidebar.pug | 13 ++++++------- layout/includes/widget/card_author.pug | 9 ++++----- package.json | 2 +- 6 files changed, 19 insertions(+), 21 deletions(-) diff --git a/_config.yml b/_config.yml index b66b992..d0c3427 100644 --- a/_config.yml +++ b/_config.yml @@ -83,7 +83,7 @@ favicon: /img/favicon.png # Avatar (頭像) avatar: - img: + img: https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png effect: false # Disable all banner image diff --git a/layout/includes/header/menu_item.pug b/layout/includes/header/menu_item.pug index 7feff6b..a10071c 100644 --- a/layout/includes/header/menu_item.pug +++ b/layout/includes/header/menu_item.pug @@ -4,7 +4,7 @@ if theme.menu .menus_items each value, label in theme.menu - if !Array.isArray(value) + if typeof value !== 'object' .menus_item a.site-page(href=url_for(trim(value.split('||')[0]))) if value.split('||')[1] @@ -18,9 +18,9 @@ if theme.menu span=' '+ trim(label.split('||')[0]) i.fas.fa-chevron-down.expand(class=sidebarChildHide) ul.menus_item_child - each i in value + each val,lab in value li - a.site-page(href=url_for(trim(i.split('||')[1]))) - if i.split('||')[2] - i.fa-fw(class=trim(i.split('||')[2])) - span=' '+trim(i.split('||')[0]) \ No newline at end of file + a.site-page(href=url_for(trim(val.split('||')[0]))) + if val.split('||')[1] + i.fa-fw(class=trim(val.split('||')[1])) + span=' '+ lab \ No newline at end of file diff --git a/layout/includes/header/nav.pug b/layout/includes/header/nav.pug index e5660e1..2b4d3da 100644 --- a/layout/includes/header/nav.pug +++ b/layout/includes/header/nav.pug @@ -8,7 +8,7 @@ nav#nav a.site-page.social-icon.search i.fas.fa-search.fa-fw span=' '+_p('search') - !=fragment_cache('menus', function(){return partial('includes/header/menu_item')}) + !=partial('includes/header/menu_item', {}, {cache: true}) #toggle-menu a.site-page diff --git a/layout/includes/sidebar.pug b/layout/includes/sidebar.pug index 1bce458..639dd79 100644 --- a/layout/includes/sidebar.pug +++ b/layout/includes/sidebar.pug @@ -1,12 +1,11 @@ #sidebar #menu-mask #sidebar-menus - if theme.avatar.img - .author-avatar - if theme.lazyload.enable - img.avatar-img(data-lazy-src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar") - else - img.avatar-img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar") + .author-avatar + if theme.lazyload.enable + img.avatar-img(data-lazy-src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar") + else + img.avatar-img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar") .site-data if site.posts.length .data-item.is-center @@ -29,4 +28,4 @@ .headline= _p('aside.categories') .length-num= site.categories.length hr - !=fragment_cache('menus', function(){return partial('includes/header/menu_item')}) + !=partial('includes/header/menu_item', {}, {cache: true}) diff --git a/layout/includes/widget/card_author.pug b/layout/includes/widget/card_author.pug index 1bbc47d..b694bd8 100644 --- a/layout/includes/widget/card_author.pug +++ b/layout/includes/widget/card_author.pug @@ -1,11 +1,10 @@ if theme.aside.card_author.enable .card-widget.card-info .card-info-avatar.is-center - if theme.avatar.img - if theme.lazyload.enable - img.avatar-img(data-lazy-src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar") - else - img.avatar-img(src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar") + if theme.lazyload.enable + img.avatar-img(data-lazy-src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar") + else + img.avatar-img(src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar") .author-info__name= config.author .author-info__description!= theme.aside.card_author.description || config.description diff --git a/package.json b/package.json index 31bad5e..a61d621 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.7.0-b4", + "version": "3.7.0-b5", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": {