diff --git a/_config.yml b/_config.yml index 586808d..ae2a6f2 100644 --- a/_config.yml +++ b/_config.yml @@ -175,7 +175,8 @@ index_post_content: # toc (目錄) toc: - enable: true + post: true + page: false number: true style_simple: false diff --git a/layout/category.pug b/layout/category.pug index 5dc21d5..234a0af 100644 --- a/layout/category.pug +++ b/layout/category.pug @@ -3,9 +3,9 @@ extends includes/layout.pug block content if theme.category_ui == 'index' include ./includes/mixins/post-ui.pug - #recent-posts.recent-posts.category_ui + #recent-posts.recent-posts.category_ui +postUI - include includes/pagination.pug + include includes/pagination.pug else include ./includes/mixins/article-sort.pug #category diff --git a/layout/includes/head/config_site.pug b/layout/includes/head/config_site.pug index 1d78e98..220c55f 100644 --- a/layout/includes/head/config_site.pug +++ b/layout/includes/head/config_site.pug @@ -1,13 +1,22 @@ - + const titleVal = pageTitle.replace(/'/ig,"\\'") + let isHighlightShrink if (theme.highlight_shrink == 'none') isHighlightShrink = 'undefined' else if (page.highlight_shrink === true || page.highlight_shrink === false) isHighlightShrink = page.highlight_shrink else isHighlightShrink = theme.highlight_shrink - var pageToc = page.toc === true || page.toc === false ? page.toc : theme.toc.enable - var showToc = is_post() && theme.aside.enable && pageToc && (toc(page.content) !== '' || page.encrypt == true ) - - let titleVal = pageTitle.replace(/'/ig,"\\'") + var showToc = false + if (theme.aside.enable) { + let tocEnable = false + if (is_post()) { + if (theme.toc.post) tocEnable = true + } else if (is_page()) { + if (theme.toc.page) tocEnable = true + } + const pageToc = page.toc === true || page.toc === false ? page.toc : tocEnable + showToc = pageToc && (toc(page.content) !== '' || page.encrypt == true ) + } - script#config-diff. diff --git a/layout/includes/header/post-info.pug b/layout/includes/header/post-info.pug index 45c430a..61b2e7b 100644 --- a/layout/includes/header/post-info.pug +++ b/layout/includes/header/post-info.pug @@ -108,4 +108,4 @@ when 'Facebook Comments' +countBlock a(href=url_for(page.path) + '#post-comment') - span.fb-comments-count(data-href=urlNoIndex()) + span.fb-comments-count(data-href=urlNoIndex()) \ No newline at end of file diff --git a/layout/includes/page/flink.pug b/layout/includes/page/flink.pug index 104d288..c986f59 100644 --- a/layout/includes/page/flink.pug +++ b/layout/includes/page/flink.pug @@ -13,8 +13,8 @@ each item in i.link_list .flink-list-item a(href=url_for(item.link) title=item.name target="_blank") - .flink-item-icon.not-lightbox - img(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name ) + .flink-item-icon + img.no-lightbox(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name ) .flink-item-name= item.name .flink-item-desc(title=item.descr)= item.descr != page.content diff --git a/layout/includes/rightside.pug b/layout/includes/rightside.pug index a52f6a1..0e0bdf5 100644 --- a/layout/includes/rightside.pug +++ b/layout/includes/rightside.pug @@ -21,13 +21,13 @@ if (theme.readmode || theme.translate.enable || (theme.darkmode.enable && theme.darkmode.button) || theme.change_font_size) button#rightside_config(type="button" title=_p("rightside.setting")) i.fas.fa-cog.fa-spin - if showToc - button#mobile-toc-button.close(type="button" title=_p("rightside.toc")) - i.fas.fa-list-ul else if theme.translate.enable || (theme.darkmode.enable && theme.darkmode.button) || theme.change_font_size button#rightside_config(type="button" title=_p("rightside.setting")) i.fas.fa-cog.fa-spin + if showToc + button#mobile-toc-button.close(type="button" title=_p("rightside.toc")) + i.fas.fa-list-ul if theme.chat_btn button#chat_btn(type="button" title=_p("rightside.chat_btn")) i.fas.fa-sms diff --git a/layout/includes/widget/index.pug b/layout/includes/widget/index.pug index f9b9930..9d523d2 100644 --- a/layout/includes/widget/index.pug +++ b/layout/includes/widget/index.pug @@ -7,7 +7,7 @@ else !=partial('includes/widget/card_author', {}, {cache: true}) !=partial('includes/widget/card_announcement', {}, {cache: true}) - !=partial('includes/widget/card_top_self', {}, {cache: true}) + !=partial('includes/widget/card_top_self', {}, {cache: true}) .sticky_layout if showToc include ./card_post_toc.pug @@ -20,6 +20,8 @@ !=partial('includes/widget/card_top_self', {}, {cache: true}) .sticky_layout + if showToc + include ./card_post_toc.pug !=partial('includes/widget/card_recent_post', {}, {cache: true}) !=partial('includes/widget/card_ad', {}, {cache: true}) !=partial('includes/widget/card_newest_comment', {}, {cache: true}) diff --git a/package.json b/package.json index a4f0af3..de4578d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "4.0.0-b3", + "version": "4.0.0-b4", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { @@ -20,7 +20,7 @@ }, "bugs": { "url": "https://github.com/jerryc127/hexo-theme-butterfly/issues", - "email": "btf@immyw.com" + "email": "i@immyw.com" }, "dependencies": { "hexo-renderer-stylus": "^2.0.1", diff --git a/scripts/tag/gallery.js b/scripts/tag/gallery.js index 82067c1..21ebb55 100644 --- a/scripts/tag/gallery.js +++ b/scripts/tag/gallery.js @@ -19,8 +19,8 @@ function galleryGroup (args) { const img = urlFor(args[3]) return ` -