From 2eb15123f9e1b15b94158995893cab2f2846c9d4 Mon Sep 17 00:00:00 2001 From: Jerry Date: Tue, 24 Sep 2019 02:09:51 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=9B=B4=E6=94=B9=E6=89=8B=E6=A9=9F?= =?UTF-8?q?=E9=A0=81=E9=9D=A2=E7=9A=84menu=E5=92=8Ctoc=E7=9A=84=E9=A1=AF?= =?UTF-8?q?=E7=A4=BA=E6=96=B9=E5=BC=8F=E5=92=8C=E9=A1=AF=E7=A4=BA=E7=89=B9?= =?UTF-8?q?=E6=95=88=EF=BC=88ipad=E4=B9=9F=E8=83=BD=E7=9C=8BTOC)=201.=20?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=89=8B=E6=A9=9F=E9=A0=81=E9=9D=A2=E7=9A=84?= =?UTF-8?q?menu=E5=92=8Ctoc=E7=9A=84=E9=A1=AF=E7=A4=BA=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E5=92=8C=E9=A1=AF=E7=A4=BA=E7=89=B9=E6=95=88=EF=BC=88ipad?= =?UTF-8?q?=E4=B9=9F=E8=83=BD=E7=9C=8BTOC)=203.=20=E5=8F=AF=E8=A8=AD?= =?UTF-8?q?=E7=BD=AE=E8=A4=87=E8=A3=BD=E6=99=82=EF=BC=8C=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E8=87=AA=E5=8B=95=E5=8A=A0=E4=B8=8A=E7=89=88=E6=AC=8A=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=204.=20=E5=8F=AF=E4=BF=AE=E6=94=B9tag=E7=9A=84top=5Fi?= =?UTF-8?q?mg=205.=20=E5=8F=AF=E4=BF=AE=E6=94=B9category=E7=9A=84top=5Fimg?= =?UTF-8?q?=206.=20=E5=8F=AF=E4=BF=AE=E6=94=B9valine=E7=9A=84=E8=83=8C?= =?UTF-8?q?=E6=99=AF=207.=20archives=E9=A0=81UI=E5=84=AA=E5=8C=96=208.=20I?= =?UTF-8?q?CP=E5=A2=9E=E5=8A=A0icon=20#37=209.=20=E5=8F=AF=E8=A8=AD?= =?UTF-8?q?=E7=BD=AE=E4=B8=BB=E9=A0=81top=5Fimg=E7=9A=84=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=2010.=20=E5=8F=AF=E8=A8=AD=E7=BD=AE=E4=B8=BB=E9=A0=81site-info?= =?UTF-8?q?=E7=9A=84=E4=BD=8D=E7=BD=AE=2011.=20category=E9=A0=81=E5=92=8Ct?= =?UTF-8?q?ag=E9=A0=81=E7=9A=84UI=E5=8F=AF=E4=BB=A5=E8=A8=AD=E7=BD=AE?= =?UTF-8?q?=E8=88=87=E4=B8=BB=E9=A0=81UI=E4=B8=80=E6=A8=A3=20#31=2012.=20?= =?UTF-8?q?=E4=B8=BB=E9=A0=81subtitle=E5=8F=AF=E8=A8=AD=E7=BD=AE=E5=A4=9A?= =?UTF-8?q?=E5=80=8B=E5=8F=A5=E5=AD=90=EF=BC=88=E4=B8=8D=E5=86=8D=E9=99=90?= =?UTF-8?q?=E5=88=B62=E5=80=8B=EF=BC=89=20#37=2013.=20=E8=A8=AD=E7=BD=AEme?= =?UTF-8?q?nu=E6=99=82=EF=BC=8C=E9=A0=AD=E5=B0=BE=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC=E4=B8=8D=E5=8F=97=E5=BD=B1=E9=9F=BF=2014.=20?= =?UTF-8?q?=E8=AA=BF=E6=95=B4post=E9=A0=81=E7=9A=84=E4=BD=88=E5=B1=80=2015?= =?UTF-8?q?.=20=E4=B9=A6=E7=AD=BE=E6=B7=BB=E5=8A=A0icon=2016.=20=E5=85=AC?= =?UTF-8?q?=E5=91=8Aicon=E6=95=88=E6=9E=9C=2017.=20=E9=A6=96=E9=A0=81?= =?UTF-8?q?=E6=AD=B8=E6=AA=94=E6=A8=A1=E5=A1=8A=EF=BC=8C=E5=8F=AF=E8=A8=AD?= =?UTF-8?q?=E7=BD=AE=E6=95=B8=E9=87=8F=E9=99=90=E5=88=B6=EF=BC=8C=E6=9C=83?= =?UTF-8?q?=E9=A1=AF=E7=A4=BA'=E6=9F=A5=E7=9C=8B=E6=9B=B4=E5=A4=9A'?= =?UTF-8?q?=E6=8C=89=E9=88=95=2018.=20=E5=8F=B3=E4=B8=8B=E8=A7=92=E6=8C=89?= =?UTF-8?q?=E9=88=95=E8=AA=BF=E6=95=B4=E3=80=82=2019.=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=96=87=E7=AB=A0cover=E9=9A=A8=E6=A9=9F=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E7=94=9F=E6=88=90=EF=BC=8C=E5=90=8C=E4=B8=80=E7=AF=87=E6=96=87?= =?UTF-8?q?=E7=AB=A0=EF=BC=8C=E4=B8=8D=E5=90=8C=E5=9C=B0=E6=96=B9=E7=9A=84?= =?UTF-8?q?cover=E9=A1=AF=E7=A4=BA=E4=B8=8D=E4=B8=80=E6=A0=B7=E7=9A=84bug?= =?UTF-8?q?=2020.=20=E4=BF=AE=E5=BE=A9gitalk=E8=AA=9E=E8=A8=80=E8=A8=AD?= =?UTF-8?q?=E7=BD=AE=E7=84=A1=E6=95=88=E7=9A=84bug=20#35=2021.=20=E4=BF=AE?= =?UTF-8?q?=E5=BE=A9post=E9=A0=81=E9=9D=A2=EF=BC=8C=E7=95=B6=E6=B2=92?= =?UTF-8?q?=E6=9C=89=E8=A8=AD=E7=BD=AEword=20count=E6=99=82=EF=BC=8C?= =?UTF-8?q?=E9=96=B2=E8=AE=80=E9=87=8F=E5=89=8D=E6=9C=89'|"=2022.=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dsub-menu=E5=9C=A8safari=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98=2023.=20=E4=BF=AE=E5=A4=8Dtags?= =?UTF-8?q?=E9=A1=B5=E8=AF=84=E8=AE=BA=E5=B1=85=E4=B8=AD=E9=97=AE=E9=A2=98?= =?UTF-8?q?=2024.=20=E4=BF=AE=E5=A4=8Dheader=20a=20hover=20=E7=99=BD?= =?UTF-8?q?=E8=89=B2=E9=97=AE=E9=A2=98=2025.=20=E4=BF=AE=E5=BE=A9=E5=A4=9C?= =?UTF-8?q?=E9=96=93=E6=A8=A1=E5=BC=8F=E4=B8=8Bfooter=E7=9A=84=E9=A1=94?= =?UTF-8?q?=E8=89=B2bug=2026.=20=E4=BF=AE=E5=BE=A9=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E8=AA=9E=E8=A8=80=E4=B8=8B=EF=BC=8C=E6=9B=B8=E7=B0=BD=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E9=A1=AF=E7=A4=BA=E4=B8=8D=E5=AE=8C=E6=95=B4=E7=9A=84?= =?UTF-8?q?=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 97 ++++-- languages/default.yml | 10 + languages/en.yml | 10 + languages/zh-CN.yml | 10 + languages/zh-TW.yml | 14 +- layout/category.pug | 24 +- layout/flink.pug | 2 +- layout/includes/additional-js.pug | 56 ++-- layout/includes/comments/gitalk.pug | 2 +- layout/includes/config.pug | 18 +- layout/includes/footer.pug | 2 + layout/includes/head.pug | 8 +- layout/includes/header.pug | 78 +---- layout/includes/layout.pug | 57 ++-- layout/includes/menu_item.pug | 20 ++ layout/includes/mixins/UI.pug | 41 +++ layout/includes/mixins/article-sort.pug | 10 +- layout/includes/mobile-sidebar.pug | 46 +++ layout/includes/nav.pug | 8 +- layout/includes/page_tag.pug | 6 + layout/includes/pagination.pug | 8 +- layout/includes/post-bottom.pug | 17 - layout/includes/recent-posts.pug | 34 +- layout/includes/reward.pug | 2 +- layout/includes/rightside.pug | 31 +- layout/includes/widget/card_author.pug | 20 +- layout/includes/widget/card_recent_post.pug | 13 +- layout/page.pug | 3 +- layout/post.pug | 14 +- layout/tag.pug | 22 +- package.json | 3 +- scripts/hexo-plugins.txt | 0 scripts/list_archives.js | 133 ++++++++ scripts/random_cover.js | 9 +- scripts/related_post.js | 15 +- scripts/tags.js | 16 - source/css/_global/index.styl | 256 ++------------- source/css/_layout/aside.styl | 133 ++++---- source/css/_layout/category.styl | 1 - source/css/_layout/comments.styl | 65 +++- source/css/_layout/flink.styl | 14 +- source/css/_layout/footer.styl | 4 + source/css/_layout/head.styl | 300 +++++------------ source/css/_layout/mobile-sidebar.styl | 163 ++++++++++ source/css/_layout/nightshift.styl | 101 +++--- source/css/_layout/note.styl | 4 +- source/css/_layout/page.styl | 64 +++- source/css/_layout/pagination.styl | 3 +- source/css/_layout/post.styl | 54 ++-- source/css/_layout/post_bottom.styl | 70 ---- source/css/_layout/readmode.styl | 71 ++-- source/css/_layout/reward.styl | 2 +- source/css/_layout/rightside.styl | 64 ++++ source/css/_layout/z-other.styl | 89 ++--- source/css/var.styl | 4 +- source/img/icp.png | Bin 0 -> 19256 bytes source/js/main.js | 341 +++++++++++--------- 57 files changed, 1438 insertions(+), 1224 deletions(-) create mode 100644 layout/includes/menu_item.pug create mode 100644 layout/includes/mixins/UI.pug create mode 100644 layout/includes/mobile-sidebar.pug create mode 100644 layout/includes/page_tag.pug delete mode 100644 layout/includes/post-bottom.pug delete mode 100644 scripts/hexo-plugins.txt create mode 100644 scripts/list_archives.js delete mode 100644 scripts/tags.js create mode 100644 source/css/_layout/mobile-sidebar.styl delete mode 100644 source/css/_layout/post_bottom.styl create mode 100644 source/css/_layout/rightside.styl create mode 100644 source/img/icp.png diff --git a/_config.yml b/_config.yml index 79a6e51..2804f3e 100644 --- a/_config.yml +++ b/_config.yml @@ -1,29 +1,20 @@ -# Theme color for customize -# Notice: color value must in double quotes like "#000" or may cause error! -# --------------- -# theme_color: -# enable: true -# main: "#49B1F5" -# paginator: "#00c4b6" -# button_hover: "#FF7242" -# text_selection: "#00c4b6" -# link_color: "#99a9bf" -# meta_color: '#858585' -# hr_color: "#A4D8FA" -# read-mode-bg_color: '#FAF9DE' -# inline-code-color: '#F47466' # Main menu navigation -# format: xxx: /xxx/||icon # --------------- +# format: xxx: 連結 || icon +# sub-menu +# xxx || icon: +# xxx || 連結 || icon menu: - Home: /||fa fa-home - Archives: /archives/||fa fa-archive - Tags: /tags/||fa fa-tags - Categories: /categories/||fa fa-folder-open - Link: /link/||fa fa-link - About: /about/||fa fa-heart -# #XXX: /xxx + Home: / || fa fa-home + Archives: /archives/ || fa fa-archive + Tags: /tags/ || fa fa-tags + Categories: /categories/ || fa fa-folder-open + Link: /link/ || fa fa-link + About: /about/ || fa fa-heart + List||fa fa-list: + - Music || /music/ || fa fa-music + - Movie || /movies/ || fa fa-film # Favicon @@ -53,6 +44,13 @@ highlight_shrink: false #代碼框不展開,需點擊 '>' 打開 code_word_wrap: false +# copy setting +# 是否禁止複製(如果禁止,highlight_copy的功能將無效) +# copyright 複製的内容後面加上版權信息 +copy: + enable: false # true 開啓 / false 禁止 + copyright: false + # social settings # formal: # icon: link @@ -149,6 +147,12 @@ default_cover: https://cdn.jsdelivr.net/gh/jerryc127/CDN@latest/cover/default_bg # the banner image of archive page archive_img: https://cdn.jsdelivr.net/gh/jerryc127/CDN@latest/Photo/archive.jpg +# the banner image of tag page +tag_img: https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/tag-bg.png + +# the banner image of category page +category_img: https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/category-bg + # if the photo link cannot connect,it will show that lodding_bg: flink: /img/friend_404.gif @@ -228,6 +232,7 @@ disqus: # repo: # owner: # admin: +# language: # en , zh-CN , zh-TW #### Using this js for redirect to gitalk container after login #### See https://github.com/gitalk/gitalk/issues/125 # js: https://cdn.jsdelivr.net/gh/upupming/gitalk@36368e5dffd049e956cdbbd751ff96c28d8255cf/dist/gitalk.min.js @@ -243,7 +248,8 @@ valine: avatar: monsterid # gravatar style https://valine.js.org/#/avatar lang: en # i18n: zh-cn/en placeholder: Please leave your footprints # valine comment input placeholder(like: Please leave your footprints ) - guest_info: nick,mail,link #valine comment header inf + guest_info: nick,mail,link #valine comment header info + bg: /img/comment_bg.png # valine background ##### Footer Settings #### # ------------------------------------ @@ -257,7 +263,8 @@ footer_copyright: ICP: enable: false url: - text: + text: + icon: /img/icp.png #### 站長驗證 #### @@ -307,6 +314,35 @@ related_post: #### 美化/效果 #### #-------------------------------- +# Theme color for customize +# Notice: color value must in double quotes like "#000" or may cause error! +# --------------- +# theme_color: +# enable: true +# main: "#49B1F5" +# paginator: "#00c4b6" +# button_hover: "#FF7242" +# text_selection: "#00c4b6" +# link_color: "#99a9bf" +# meta_color: '#858585' +# hr_color: "#A4D8FA" +# read-mode-bg_color: '#FAF9DE' +# inline-code-color: '#F47466' + +# 主頁設置 +# 默認top_img全屏,site_info在中間 +# 使用默認, 都無需填寫(建議默認) +index_site_info_top: #主頁標題距離頂部距離 例如 300px/300em/300rem/10% +index_top_img_height: #主頁top_img高度 例如 300px/300em/300rem 不能使用百分比 + + +# category和tag頁的UI設置 +# index 值代表 UI將與首頁的UI一樣 +# 默認跟archives頁面UI一樣 +category_ui: # 留空或index +tag_ui: # 留空或index + + # 設置網站背景 # 可設置圖片 或者 顔色 # 圖片格式 background: url(http://xxxxxx.com/xxx.jpg) @@ -366,14 +402,14 @@ post_beautify: # 全局字體 font: enable: false - font-family: Lato, Helvetica Neue For Number, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB,"Microsoft JhengHei", "MicrMicrosoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif - code-font: consolas, Menlo, "PingFang SC", "Microsoft JhengHei","Microsoft YaHei", monospace, Helvetica Neue For Number + font-family: Lato, Helvetica Neue For Number, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB, MicrMicrosoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif + code-font: consolas, Menlo, "PingFang SC", "Microsoft YaHei", monospace, Helvetica Neue For Number # 網站名字字體 # 左上角網站名字 主頁居中網站名字 blog_title_font: font_link: https://fonts.googleapis.com/css?family=Titillium+Web #字體鏈接 - font-family: Titillium Web, PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif + font-family: Titillium Web, PingFang SC, Hiragino Sans GB, "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif # 水平分隔綫 hr: @@ -383,11 +419,12 @@ hr: # 主頁subtitle # 打字效果 +# (如果有英文逗號' , ',請使用轉義字符 ,) subtitle: enable: true - sub1: 今日事,今日畢 - sub2: Never put off till tomorrow what you can do today #如果有符號 ' ,記得前面加上 \ - + sub: + - 今日事,今日畢 + - Never put off till tomorrow what you can do today diff --git a/languages/default.yml b/languages/default.yml index 223beff..e63dedc 100644 --- a/languages/default.yml +++ b/languages/default.yml @@ -82,5 +82,15 @@ rightside: font_minus_title: Decrease font size translate_title: Traditional Chinese and Simplified Chinese Conversion night_mode_title: Dark Mode + back_to_top: Back to top + toc: Table of Contents + scroll_to_comment: Scroll to comment + setting: Setting runtime_unit: days + +copy_copyright: + author: Author + link: Link + source: Source + info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source. diff --git a/languages/en.yml b/languages/en.yml index 0940c4e..f57b058 100644 --- a/languages/en.yml +++ b/languages/en.yml @@ -81,5 +81,15 @@ rightside: font_minus_title: Decrease font size translate_title: Traditional Chinese and Simplified Chinese Conversion night_mode_title: Dark Mode + back_to_top: Back to top + toc: Table of Contents + scroll_to_comment: Scroll to comment + setting: Setting runtime_unit: days + +copy_copyright: + author: Author + link: Link + source: Source + info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source. \ No newline at end of file diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index 65019f8..7d1fc14 100644 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -82,5 +82,15 @@ rightside: font_minus_title: 缩小字体 translate_title: 简繁转换 night_mode_title: 夜间模式 + back_to_top: 回到顶部 + toc: 目录 + scroll_to_comment: 直达评论 + setting: 设置 runtime_unit: 天 + +copy_copyright: + author: 作者 + link: 链接 + source: 来源 + info: 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 \ No newline at end of file diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml index 7eab355..727b779 100644 --- a/languages/zh-TW.yml +++ b/languages/zh-TW.yml @@ -15,7 +15,7 @@ page: articles: 文章總覽 tag: 標籤 category: 分類 - archives: 歸檔 + archives: 時間軸 sticky: 置頂 no_title: 無題 @@ -83,5 +83,15 @@ rightside: font_minus_title: 縮小字體 translate_title: 簡繁轉換 night_mode_title: 夜間模式 + back_to_top: 回到頂部 + toc: 目錄 + scroll_to_comment: 直達評論 + setting: 設置 -runtime_unit: 天 \ No newline at end of file +runtime_unit: 天 + +copy_copyright: + author: 作者 + link: 鏈接 + source: 來源 + info: 著作權歸作者所有。商業轉載請聯繫作者獲得授權,非商業轉載請註明出處。 \ No newline at end of file diff --git a/layout/category.pug b/layout/category.pug index 05617ee..457592d 100644 --- a/layout/category.pug +++ b/layout/category.pug @@ -1,11 +1,19 @@ extends includes/layout.pug block content - include ./includes/mixins/article-sort.pug - #category - .article-sort-title= _p('page.category') + ' - ' + page.category - +articleSort(page.posts) - include includes/pagination.pug - #aside_content.aside_content - include includes/aside.pug - \ No newline at end of file + if theme.category_ui == 'index' + include ./includes/mixins/UI.pug + #recent-posts.recent-posts.category_ui + +UI_NEW(page.posts) + include includes/pagination.pug + #aside_content.aside_content + include includes/aside.pug + else + include ./includes/mixins/article-sort.pug + #category + .article-sort-title= _p('page.category') + ' - ' + page.category + +articleSort(page.posts) + include includes/pagination.pug + #aside_content.aside_content + include includes/aside.pug + \ No newline at end of file diff --git a/layout/flink.pug b/layout/flink.pug index de257c7..a2f0fe5 100644 --- a/layout/flink.pug +++ b/layout/flink.pug @@ -1,6 +1,6 @@ .flink each i in site.data.link - p.comment-word= i.class_name + h1= i.class_name .post-cards ul.md-links each item in i.link_list diff --git a/layout/includes/additional-js.pug b/layout/includes/additional-js.pug index 49253be..cacb670 100644 --- a/layout/includes/additional-js.pug +++ b/layout/includes/additional-js.pug @@ -45,49 +45,13 @@ if is_home() && theme.subtitle.enable script(src="https://cdn.jsdelivr.net/npm/typed.js@2.0.9") script. var typed = new Typed(".subtitle", { - strings: ['!{theme.subtitle.sub1}','!{theme.subtitle.sub2}'], + strings: '!{theme.subtitle.sub}'.split(","), startDelay: 300, typeSpeed: 100, loop: true, backSpeed: 50 }); -if is_home() - script. - //首頁fullpage - function alignContent() { - for (var n = $(window).height(), e = document.querySelectorAll(".full_page"), i = 0; i < e.length; i++) - e[i].style.height = n + "px"; - $("#site-info").each(function () { - var x = $(this).height(); - $(this).css("top", (n-x)/2) - }) - } - - function recent_post_padding() { - $(".recent-post-info").each(function () { - var k = $(".recent-post-item").height(); - var e = $(this).height(); - $(this).css({"padding-top": (k-e)/2 , "padding-bottom": (k-e)/2 }) - }) - } - - alignContent(); - - //recent-post-item垂直置中 - if ($(window).width() > 768) { - recent_post_padding(); - } - - $(window).bind("resize", function () { - - alignContent() - - if ($(window).width() > 768) { - recent_post_padding(); - } - }) - if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv script(async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js") @@ -99,3 +63,21 @@ if theme.lazyload.enable script. const observer = lozad(); // lazy loads elements with default selector as '.lozad' observer.observe(); + +if is_home() && !theme.index_top_img_height && !theme.index_site_info_top + script. + //首頁fullpage + function alignContent() { + for (var n = $(window).height(), e = document.querySelectorAll(".full_page"), i = 0; i < e.length; i++) + e[i].style.height = n + "px"; + $("#site-info").each(function () { + var x = $(this).height(); + $(this).css("top", (n-x)/2) + }) + } + alignContent(); + + $(window).bind("resize", function () { + alignContent() + }) + diff --git a/layout/includes/comments/gitalk.pug b/layout/includes/comments/gitalk.pug index e222491..1474168 100644 --- a/layout/includes/comments/gitalk.pug +++ b/layout/includes/comments/gitalk.pug @@ -8,6 +8,6 @@ if theme.gitalk && theme.gitalk.enable owner: '!{theme.gitalk.owner}', admin: '!{theme.gitalk.admin}', id: md5(decodeURI(location.pathname)), - language: '!{lang}' + language: '!{theme.gitalk.language}' }) gitalk.render('gitalk-container') \ No newline at end of file diff --git a/layout/includes/config.pug b/layout/includes/config.pug index c32460c..7c5c020 100644 --- a/layout/includes/config.pug +++ b/layout/includes/config.pug @@ -28,7 +28,6 @@ } var translate = 'undefined'; if (theme.translate && theme.translate.enable){ - var defaultEncoding; translate = JSON.stringify({ defaultEncoding: theme.translate.defaultEncoding, translateDelay: theme.translate.translateDelay, @@ -38,7 +37,19 @@ }) } + var copyright = 'undefined' ; + if (theme.copy.enable && theme.copy.copyright){ + copyright = JSON.stringify({ + languages: { + author: _p("copy_copyright.author") + ': ' + config.author, + link: _p("copy_copyright.link") + ': ' + without_html, + source: _p("copy_copyright.source") + ': ' + config.title, + info: _p("copy_copyright.info") + } + }) + } + var copy_copyright_js = theme.copy.enable && theme.copy.copyright @@ -61,8 +72,9 @@ script. message_prev: '!{_p("bookmark.message_prev")}', message_next: '!{_p("bookmark.message_next")}' }, - runtime_unit: '!{_p("runtime_unit")}' - + runtime_unit: '!{_p("runtime_unit")}', + copyright: !{copyright}, + copy_copyright_js: !{copy_copyright_js} } diff --git a/layout/includes/footer.pug b/layout/includes/footer.pug index f9fefba..420afdc 100644 --- a/layout/includes/footer.pug +++ b/layout/includes/footer.pug @@ -19,4 +19,6 @@ if theme.ICP.enable .icp a(href=theme.ICP.url) + if theme.ICP.icon + img.icp-icon(src=url_for(theme.ICP.icon)) span=theme.ICP.text diff --git a/layout/includes/head.pug b/layout/includes/head.pug index e732157..0685ce1 100644 --- a/layout/includes/head.pug +++ b/layout/includes/head.pug @@ -1,6 +1,6 @@ - var without_index = url.replace('index.html', '') - var without_html = without_index.replace('.html', '') -- var photo_check = page.cover || theme.avatar +- var photo_check = is_post() ? page.cover || theme.avatar : theme.avatar - var photo_link = url_check (photo_check) ? photo_check : config.url + photo_check meta(http-equiv="x-dns-prefetch-control" content="on") @@ -107,10 +107,16 @@ if theme.qihu_site_verification - var preload_archive_img = theme.archive_img ||theme.top_img || config.top_img +- var preload_tag_img = theme.tag_img ||theme.top_img || config.top_img +- var preload_category_img = theme.category_img ||theme.top_img || config.top_img - var preload_img = page.top_img || theme.top_img || config.top_img if (is_archive() && preload_archive_img) link(rel="preload" href=url_for(preload_archive_img) as="image" ) +else if (is_tag() && preload_tag_img) + link(rel="preload" href=url_for(preload_tag_img) as="image" ) +else if (is_category() && preload_category_img) + link(rel="preload" href=url_for(preload_category_img) as="image" ) else if (!is_post() && preload_img) link(rel="preload" href=url_for(preload_img) as="image" ) diff --git a/layout/includes/header.pug b/layout/includes/header.pug index b49db42..da1a9c2 100644 --- a/layout/includes/header.pug +++ b/layout/includes/header.pug @@ -1,65 +1,13 @@ -#page-header - span.pull-left - a#site-name.blog_title(href=url_for('/')) #[=config.title] - //- i.fa.fa-bars.toggle-menu.pull-right(aria-hidden="true") - .open.toggle-menu.pull-right - .menu-icon-first - .menu-icon-second - .menu-icon-third - - .menu_mask - - span.pull-right.menus - .mobile_author_icon - img.lozad.avatar_img(src=theme.avatar || url_for('/img/avatar.png') onerror=`onerror=null;src='${theme.lodding_bg.flink}'`) - .mobile_post_data - if site.posts.length - .mobile_data_item.text-center - .mobile_data_link - a(href=url_for(config.archive_dir) + '/') - .headline= _p('aside.articles') - .length_num= site.posts.length - - if site.tags.length - .mobile_data_item.text-center - .mobile_data_link - a(href=url_for(config.tag_dir) + '/' ) - .headline= _p('aside.tags') - .length_num= site.tags.length - - if site.categories.length - .mobile_data_item.text-center - .mobile_data_link - a(href=url_for(config.category_dir) + '/') - .headline= _p('aside.categories') - .length_num= site.categories.length - - hr - .menus_items - each value, label in theme.menu - if !Array.isArray(value) - .menus_item - a.site-page(href=value.split('||')[0]) - i.fa-fw(class=value.split('||')[1]) - span=' '+label - else - .menus_item - a.site-page - i.fa-fw(class=label.split('||')[1] aria-hidden="true") - span=' '+label.split('||')[0] - i.fa.fa-chevron-down.menus-expand(aria-hidden="true") - ul.menus_item_child - each i in value - li - a.site-page(href=i.split('||')[1]) - i.fa-fw(class=i.split('||')[2]) - span=' '+i.split('||')[0] - - - script. - document.body.addEventListener('touchstart', function(){ }); - span.pull-right - if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable) - a.site-page.social-icon.search - i.fa.fa-search.fa-fw - span=' '+_p('search') +#header + #page-header + span#blog_name.pull-left + a#site-name.blog_title(href=url_for('/')) #[=config.title] + i.fa.fa-bars.fa-fw.toggle-menu.pull-right.close(aria-hidden="true") + span.pull-right.menus + .menus_items + include menu_item.pug + span#search_button.pull-right + if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable) + a.site-page.social-icon.search + i.fa.fa-search.fa-fw + span=' '+_p('search') diff --git a/layout/includes/layout.pug b/layout/includes/layout.pug index 53c45d2..ff4a3d9 100644 --- a/layout/includes/layout.pug +++ b/layout/includes/layout.pug @@ -16,9 +16,10 @@ - config.subtitle ? home_subtitle_true = ' - ' + config.subtitle : home_subtitle_true = '' //- home時pageTitle顯示 JerryC - subtitle,其他顯示 pageTitle | JerryC - is_home() ? pageTitle = config.title + home_subtitle_true : pageTitle = pageTitle_saved +//- 判断keywords - var pageDescription = page.description || page.title || config.description || '' -- var pageKeywords = (config.keywords || []).join(',') +- var pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords - if (page.tags && page.tags.data) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',') - var pageAuthor = config.email ? config.author + ',' + config.email : config.author - var pageCopyright = config.copyright || config.author @@ -49,35 +50,35 @@ html(lang=config.language) body(class=body_class) if theme.fireworks && theme.fireworks.enable canvas.fireworks - if theme.background - #web_bg - if (is_post() && page.toc != false && theme.toc.enable) - i.fa.fa-arrow-right#toggle-sidebar(aria-hidden="true") - include ./sidebar.pug - if (!is_post()) - include ./nav.pug - #content-outer - block top_img + include ./header.pug + include ./mobile-sidebar.pug + #body-wrap + if theme.background + #web_bg + if (is_post() && page.toc != false && theme.toc.enable) + i.fa.fa-arrow-right#toggle-sidebar(aria-hidden="true") + include ./sidebar.pug if (!is_post()) - #content-inner.layout_page - if body - div!= body - else - block content - else - #content-inner.layout.layout_post - if body - div!= body - else - block content - - - var footer_bg = theme.footer_bg == false ? '' : bg_img - footer(style=footer_bg) - include ./footer.pug - i.fa.fa-arrow-up#go-up(aria-hidden="true") + include ./nav.pug + #content-outer + block top_img + if (!is_post()) + #content-inner.layout_page + if body + div!= body + else + block content + else + #content-inner.layout.layout_post + if body + div!= body + else + block content + + - var footer_bg = theme.footer_bg == false ? '' : bg_img + footer(style=footer_bg) + include ./footer.pug include ./rightside.pug - if (is_post()) - include ./post-bottom.pug each item in theme.cdn.js if item !== undefined script(src=url_for(item)) diff --git a/layout/includes/menu_item.pug b/layout/includes/menu_item.pug new file mode 100644 index 0000000..09b2d97 --- /dev/null +++ b/layout/includes/menu_item.pug @@ -0,0 +1,20 @@ +each value, label in theme.menu + if !Array.isArray(value) + .menus_item + a.site-page(href=trim(value.split('||')[0])) + i.fa-fw(class=trim(value.split('||')[1])) + span=' '+label + else + .menus_item + a.site-page + i.fa-fw(class=trim(label.split('||')[1]) aria-hidden="true") + span=' '+ trim(label.split('||')[0]) + i.fa.fa-chevron-down.menus-expand(aria-hidden="true") + ul.menus_item_child + each i in value + li + a.site-page(href=trim(i.split('||')[1])) + i.fa-fw(class=trim(i.split('||')[2])) + span=' '+trim(i.split('||')[0]) +script. + document.body.addEventListener('touchstart', function(){ }); diff --git a/layout/includes/mixins/UI.pug b/layout/includes/mixins/UI.pug new file mode 100644 index 0000000..213856a --- /dev/null +++ b/layout/includes/mixins/UI.pug @@ -0,0 +1,41 @@ +mixin UI_NEW(posts) + - posts.each(function(article,index){ + .recent-post-item.article-container + - var link = article.link || article.path + if index%2 == 0 + .post_cover.is_left + a(href=url_for(link) title=article.title || _p('no_title')) + - var post_cover = article.cover + if theme.lazyload.enable + img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) + else + img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) + else + .post_cover.is_right + a(href=url_for(link) title=article.title || _p('no_title')) + - var post_cover = article.cover + if theme.lazyload.enable + img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) + else + img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) + .recent-post-info + a.article-title(href=url_for(link) title= article.title || _p('no_title'))= article.title || _p('no_title') + if (theme.post_meta.date_type) + - var date_type = theme.post_meta.date_type == 'updated' ? 'updated' : 'date' + time.post-meta__date #[i.fa.fa-calendar(aria-hidden="true")] #[=date(article[date_type], config.date_format)] + if (theme.post_meta.categories && article.categories.data.length > 0) + span.article-meta + span.article-meta__separator | + each item, index in article.categories.data + i.fa.fa-inbox.article-meta__icon(aria-hidden="true") + a(href=url_for(item.path)).article-meta__categories #[=item.name] + if (index < article.categories.data.length - 1) + i.fa.fa-angle-right(aria-hidden="true") + if theme.auto_excerpt && theme.auto_excerpt.enable + - const content = strip_html(article.content) + - let expert = content.substring(0, theme.auto_excerpt.length) + - content.length > theme.auto_excerpt.length ? expert += ' ...' : '' + .content!= expert + else + .content!= article.description + - }) \ No newline at end of file diff --git a/layout/includes/mixins/article-sort.pug b/layout/includes/mixins/article-sort.pug index 6da3f21..02f88ca 100644 --- a/layout/includes/mixins/article-sort.pug +++ b/layout/includes/mixins/article-sort.pug @@ -7,6 +7,12 @@ mixin articleSort(posts) - year = tempYear .article-sort-item.year= year .article-sort-item - time.article-sort-item__time= date(article.date) - a.article-sort-item__title(href=url_for(article.path))= article.title || 'No Title' + .article-sort-img + a.article-sort-item__img(href=url_for(article.path)) + img(src=article.cover) + .article-sort-post + a.article-sort-item__post(href=url_for(article.path)) + i.fa.fa-clock-o(aria-hidden="true") + time.article-sort-item__time= date(article.date) + .article-sort-item__title= article.title || 'No Title' - }) \ No newline at end of file diff --git a/layout/includes/mobile-sidebar.pug b/layout/includes/mobile-sidebar.pug new file mode 100644 index 0000000..b9e1013 --- /dev/null +++ b/layout/includes/mobile-sidebar.pug @@ -0,0 +1,46 @@ +#mobile-sidebar + #menu_mask + #mobile-sidebar-menus + .mobile_author_icon + img.lozad.avatar_img(src=url_for(theme.avatar) onerror=`onerror=null;src='${theme.lodding_bg.flink}'`) + .mobile_post_data + if site.posts.length + .mobile_data_item.is_center + .mobile_data_link + a(href=url_for(config.archive_dir) + '/') + .headline= _p('aside.articles') + .length_num= site.posts.length + + if site.tags.length + .mobile_data_item.is_center + .mobile_data_link + a(href=url_for(config.tag_dir) + '/' ) + .headline= _p('aside.tags') + .length_num= site.tags.length + + if site.categories.length + .mobile_data_item.is_center + .mobile_data_link + a(href=url_for(config.category_dir) + '/') + .headline= _p('aside.categories') + .length_num= site.categories.length + hr + .menus_items + include menu_item.pug + + + + - const showToc = is_post() && page.toc != false && theme.toc.enable + - + let tocNumber + if (page.toc_number !== undefined) tocNumber = page.toc_number + else if (theme.toc.number !== undefined) tocNumber = theme.toc.number + else tocNumber = true + - + if (showToc) + #mobile-sidebar-toc + .toc_mobile_headline= _p('sidebar.catalog') + if (page.encrypt == true) + .toc-div-class(style="display:none")!=toc(page.origin,{"class":"toc_mobile_items",list_number:tocNumber}) + else + !=toc(page.content,{"class":"toc_mobile_items",list_number:tocNumber}) diff --git a/layout/includes/nav.pug b/layout/includes/nav.pug index 4738f48..c2476a4 100644 --- a/layout/includes/nav.pug +++ b/layout/includes/nav.pug @@ -1,5 +1,9 @@ -if (is_archive()) +if is_archive() - var top_img = theme.archive_img ||theme.top_img || config.top_img +else if is_tag() + - var top_img = theme.tag_img ||theme.top_img || config.top_img +else if is_category() + - var top_img = theme.category_img ||theme.top_img || config.top_img else - var top_img = page.top_img||theme.top_img || config.top_img @@ -9,7 +13,6 @@ else if is_home() nav#nav.full_page .nav_bg(style=bg_img) - include ./header.pug #site-info #site-title span.blogtitle= page.title || page.tag || page.category || config.title @@ -28,7 +31,6 @@ if is_home() else nav#nav.not_index_bg .nav_bg(style=bg_img) - include ./header.pug #page_site-info #site-title if (is_archive()) diff --git a/layout/includes/page_tag.pug b/layout/includes/page_tag.pug new file mode 100644 index 0000000..e779798 --- /dev/null +++ b/layout/includes/page_tag.pug @@ -0,0 +1,6 @@ +- site.tags.sort('path').each(function (tags){ + - var fontSize = Math.floor(Math.random() * 15 + 15) + "px"; //15 ~ 30 + - var color = "rgb(" + Math.floor(Math.random() * 201) + ", " + Math.floor(Math.random() * 201) +", " + Math.floor(Math.random() * 201) +")"; // 0,0,0 -> 200,200,200 + + a(href=url_for(tags.path) style='font-size:' + fontSize + ';color:' + color)=tags.name +-}) \ No newline at end of file diff --git a/layout/includes/pagination.pug b/layout/includes/pagination.pug index a0ba097..06f0a3d 100644 --- a/layout/includes/pagination.pug +++ b/layout/includes/pagination.pug @@ -14,7 +14,7 @@ else if(page.prev) if(page.next) .prev-post.pull-left - - var pagination_cover = page.prev.cover || random_cover() + - var pagination_cover = page.prev.cover a(href=url_for(page.prev.path)) if theme.lazyload.enable img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` ) @@ -26,7 +26,7 @@ else span=page.prev.title else .prev-post.pull-full - - var pagination_cover = page.prev.cover || random_cover() + - var pagination_cover = page.prev.cover a(href=url_for(page.prev.path)) if theme.lazyload.enable img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) @@ -39,7 +39,7 @@ else if(page.next) if(page.prev) .next-post.pull-right - - var pagination_cover = page.next.cover || random_cover() + - var pagination_cover = page.next.cover a(href=url_for(page.next.path)) if theme.lazyload.enable img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) @@ -50,7 +50,7 @@ else span=page.next.title else .next-post.pull-full - - var pagination_cover = page.next.cover || random_cover() + - var pagination_cover = page.next.cover a(href=url_for(page.next.path)) if theme.lazyload.enable img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) diff --git a/layout/includes/post-bottom.pug b/layout/includes/post-bottom.pug deleted file mode 100644 index 240b5b3..0000000 --- a/layout/includes/post-bottom.pug +++ /dev/null @@ -1,17 +0,0 @@ -- var no_comment_show = page.comments !== false ? '' : 'no_comment_show' -- var no_toc_show = (is_post() && page.toc != false && theme.toc.enable) ? '' : 'no_toc_show' -#post_bottom(class= no_comment_show + ' ' + no_toc_show) - #post_bottom_items - if page.comments !== false - a#mobile_to_comment(href="#post-comment") - i.mobile_scroll_to_comment.fa.fa-comments - - if (is_post() && page.toc != false && theme.toc.enable) - i#mobile_toc.fa.fa-list - #toc_mobile - .toc_mobile_headline= _p('sidebar.catalog') - if (page.encrypt == true) - .toc-div-class(style="display:none")!=toc(page.origin,{"class":"toc_mobile_items"}) - else - !=toc(page.content,{"class":"toc_mobile_items"}) - diff --git a/layout/includes/recent-posts.pug b/layout/includes/recent-posts.pug index 75a7ef3..69877c7 100644 --- a/layout/includes/recent-posts.pug +++ b/layout/includes/recent-posts.pug @@ -5,32 +5,18 @@ each article , index in page.posts.data .post_cover.is_left a(href=url_for(link) title=article.title || _p('no_title')) - var post_cover = article.cover - - var default_post_cover = random_cover() - if (post_cover) - if theme.lazyload.enable - img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) - else - img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) + if theme.lazyload.enable + img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) else - if theme.lazyload.enable - img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) - else - img.post_bg(src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) + img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) else .post_cover.is_right a(href=url_for(link) title=article.title || _p('no_title')) - var post_cover = article.cover - - var default_post_cover = random_cover() - if (post_cover) - if theme.lazyload.enable - img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) - else - img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) + if theme.lazyload.enable + img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) else - if theme.lazyload.enable - img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) - else - img.post_bg(src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) + img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) .recent-post-info a.article-title(href=url_for(link) title= article.title || _p('no_title'))= article.title || _p('no_title') if (article.top) @@ -49,14 +35,6 @@ each article , index in page.posts.data a(href=url_for(item.path)).article-meta__categories #[=item.name] if (index < article.categories.data.length - 1) i.fa.fa-angle-right(aria-hidden="true") - //- if (theme.post_meta.tags && article.tags.data.length > 0) - //- span.article-meta.tags - //- span.article-meta__separator | - //- each item, index in article.tags.data - //- i.fa.fa-tag.article-meta__icon(aria-hidden="true") - //- a(href=url_for(item.path)).article-meta__tags #[=item.name] - //- if (index < article.tags.data.length - 1) - //- span.article-meta__link - if theme.auto_excerpt && theme.auto_excerpt.enable - const content = strip_html(article.content) - let expert = content.substring(0, theme.auto_excerpt.length) diff --git a/layout/includes/reward.pug b/layout/includes/reward.pug index f8c7b7e..695572d 100644 --- a/layout/includes/reward.pug +++ b/layout/includes/reward.pug @@ -1,5 +1,5 @@ .post-reward - a.reward-buttom + a.reward-button i.fa.fa-qrcode = ' ' + _p('donate') .reward-main diff --git a/layout/includes/rightside.pug b/layout/includes/rightside.pug index c750e09..92b36b1 100644 --- a/layout/includes/rightside.pug +++ b/layout/includes/rightside.pug @@ -1,13 +1,20 @@ section#rightside.rightside - if is_post() && page.comments !== false - a#to_comment(href="#post-comment") - i.scroll_to_comment.fa.fa-comments - if theme.readmode.enable && is_post() - i#readmode.fa.fa-book(title=_p('rightside.readmode_title')) - i#font_plus.fa.fa-plus(title=_p('rightside.font_plus_title')) - i#font_minus.fa.fa-minus(title=_p('rightside.font_minus_title')) - if theme.translate && theme.translate.enable - a#translateLink.translate_chn_to_cht(href="javascript:translatePage();" title=_p('rightside.translate_title'))= theme.translate.default - if theme.nightshift.enable - - var display_mode = theme.display_mode == 'night'? 'fa fa-sun-o' : 'fa fa-moon-o' - i#nightshift.nightshift(class=display_mode title=_p('rightside.night_mode_title')) + #rightside-config-hide + if theme.readmode.enable && is_post() + i#readmode.fa.fa-book(title=_p('rightside.readmode_title')) + i#font_plus.fa.fa-plus(title=_p('rightside.font_plus_title')) + i#font_minus.fa.fa-minus(title=_p('rightside.font_minus_title')) + if theme.translate && theme.translate.enable + a#translateLink.translate_chn_to_cht(href="javascript:translatePage();" title=_p('rightside.translate_title'))= theme.translate.default + if theme.nightshift && theme.nightshift.enable + - var display_mode = theme.display_mode == 'night'? 'fa fa-sun-o' : 'fa fa-moon-o' + i#nightshift.nightshift(class=display_mode title=_p('rightside.night_mode_title')) + #rightside-config-show + #rightside_config(title=_p("rightside.setting")) + i.fa.fa-cog(aria-hidden="true") + if is_post() && page.comments !== false + a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment")) + i.scroll_to_comment.fa.fa-comments + if is_post() && page.toc != false && theme.toc.enable + i#mobile-toc-button.fa.fa-list-ul.close(title=_p("rightside.toc") aria-hidden="true") + i.fa.fa-arrow-up#go-up(title=_p("rightside.back_to_top") aria-hidden="true") diff --git a/layout/includes/widget/card_author.pug b/layout/includes/widget/card_author.pug index 0e4ee3e..045b3be 100644 --- a/layout/includes/widget/card_author.pug +++ b/layout/includes/widget/card_author.pug @@ -1,35 +1,37 @@ .card_widget.card-author .card-content .post_data - .data-item.text-center - img.lozad.avatar_img(src=theme.avatar || url_for('/img/avatar.png') onerror=`onerror=null;src='${theme.lodding_bg.flink}'`) - p.author-info__name.text-center= config.author - p.author-info__description.text-center= config.description + .data-item.is_center + img.lozad.avatar_img(src=url_for(theme.avatar) onerror=`onerror=null;src='${theme.lodding_bg.flink}'`) + p.author-info__name.is_center= config.author + p.author-info__description.is_center= config.description .post_data.data_config if site.posts.length - .data-item.text-center + .data-item.is_center .data_link a(href=url_for(config.archive_dir) + '/') p.headline= _p('aside.articles') p.length_num= site.posts.length if site.tags.length - .data-item.text-center + .data-item.is_center .data_link a(href=url_for(config.tag_dir) + '/' ) p.headline= _p('aside.tags') p.length_num= site.tags.length if site.categories.length - .data-item.text-center + .data-item.is_center .data_link a(href=url_for(config.category_dir) + '/') p.headline= _p('aside.categories') p.length_num= site.categories.length - .post_data.text-center - a#bookmark-it.data-item.bookmark.bookmarke--primary.bookmark--animated(href="javascript:;" title= _p('aside.card_bookmark') )= _p('aside.card_bookmark') || 'Follow Me' + .post_data.is_center + a#bookmark-it.data-item.bookmark.bookmarke--primary.bookmark--animated(href="javascript:;" title= _p('aside.card_bookmark') ) + i.fa.fa-bookmark(aria-hidden="true") + span= _p('aside.card_bookmark') || 'Follow Me' diff --git a/layout/includes/widget/card_recent_post.pug b/layout/includes/widget/card_recent_post.pug index 671187c..160d440 100644 --- a/layout/includes/widget/card_recent_post.pug +++ b/layout/includes/widget/card_recent_post.pug @@ -9,18 +9,11 @@ - var link = article.link || article.path a(href=url_for(link)) - var post_cover = article.cover - - var default_post_cover = random_cover() .aside_post_cover - if (post_cover) - if theme.lazyload.enable - img.aside_post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title')) - else - img.aside_post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title')) + if theme.lazyload.enable + img.aside_post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title')) else - if theme.lazyload.enable - img.aside_post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title')) - else - img.aside_post_bg(src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title')) + img.aside_post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title')) div#aside_title .aside_post_title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title') if (theme.post_meta.date_type) diff --git a/layout/page.pug b/layout/page.pug index 0700295..210144b 100644 --- a/layout/page.pug +++ b/layout/page.pug @@ -6,7 +6,8 @@ block content .tag-cloud__title= _p('page.tag') | - span.tag-cloud__amount= site.tags.length - .tag-cloud-tags!= tags(site.tags) + .tag-cloud-tags + include includes/page_tag.pug if page.comments !== false include includes/comments/index.pug #aside_content.aside_content diff --git a/layout/post.pug b/layout/post.pug index 93bdc68..2de421c 100644 --- a/layout/post.pug +++ b/layout/post.pug @@ -4,7 +4,6 @@ block top_img - var top_img = page.top_img || page.cover || theme.post_meta.top_img || theme.post_img || theme.top_img || config.top_img - var bg_img = top_img !== true ? `background-image: url(${top_img})` : '' div#top-container(style=bg_img) - include ./includes/header.pug #post-info #post-title .posttitle=page.title || _p('no_title') @@ -30,16 +29,17 @@ block top_img a(href=url_for(item.path)).post-meta__categories #[=item.name] if (index < page.categories.data.length - 1) i.fa.fa-angle-right(aria-hidden="true") - if (theme.wordcount && theme.wordcount.enable) - .post-meta-wordcount + .post-meta-wordcount + if (theme.wordcount && theme.wordcount.enable) span= _p('post.wordcount') + ': ' span.word-count= wordcount(page.content) span.post-meta__separator | span= _p('post.min2read', min2read(page.content, {cn: 350, en: 160})) - if theme.busuanzi.page_pv - span.post-meta__separator | - span= _p('post.page_pv') + ': ' - span#busuanzi_value_page_pv + if (theme.wordcount && theme.wordcount.enable && theme.busuanzi.page_pv) + span.post-meta__separator | + if theme.busuanzi.page_pv + span= _p('post.page_pv') + ': ' + span#busuanzi_value_page_pv block content diff --git a/layout/tag.pug b/layout/tag.pug index 4a6dce5..0acedd7 100644 --- a/layout/tag.pug +++ b/layout/tag.pug @@ -1,10 +1,18 @@ extends includes/layout.pug block content - include ./includes/mixins/article-sort.pug - #tag - .article-sort-title= _p('page.tag') + ' - ' + page.tag - +articleSort(page.posts) - include includes/pagination.pug - #aside_content.aside_content - include includes/aside.pug + if theme.tag_ui == 'index' + include ./includes/mixins/UI.pug + #recent-posts.recent-posts + +UI_NEW(page.posts) + include includes/pagination.pug + #aside_content.aside_content + include includes/aside.pug + else + include ./includes/mixins/article-sort.pug + #tag + .article-sort-title= _p('page.tag') + ' - ' + page.tag + +articleSort(page.posts) + include includes/pagination.pug + #aside_content.aside_content + include includes/aside.pug diff --git a/package.json b/package.json index b0b6523..fcbc007 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "name": "hexo-theme-melody", - "version": "1.1.5", + "version": "1.2.0", "description": "A Hexo Theme: Butterfly" - } \ No newline at end of file diff --git a/scripts/hexo-plugins.txt b/scripts/hexo-plugins.txt deleted file mode 100644 index e69de29..0000000 diff --git a/scripts/list_archives.js b/scripts/list_archives.js new file mode 100644 index 0000000..420442d --- /dev/null +++ b/scripts/list_archives.js @@ -0,0 +1,133 @@ +'use strict'; + +hexo.extend.helper.register('list_archives', function (options = {}) { + + const { + config + } = this; + const archiveDir = config.archive_dir; + const { + timezone + } = config; + const lang = this.page.lang || this.page.language || config.language; + let { + format + } = options; + const type = options.type || 'monthly'; + const { + style = 'list', transform, separator = ', ' + } = options; + const showCount = Object.prototype.hasOwnProperty.call(options, 'show_count') ? options.show_count : true; + const className = options.class || 'archive'; + const order = options.order || -1; + const limit = 8; + let result = ''; + + var more_button + if (lang === 'zh-CN') { + more_button = '查看更多'; + } else if (lang === 'zh-TW') { + more_button = '查看更多'; + } else { + more_button = 'More'; + } + + + if (!format) { + format = type === 'monthly' ? 'MMMM YYYY' : 'YYYY'; + } + + const posts = this.site.posts.sort('date', order); + if (!posts.length) return result; + + const data = []; + let length = 0; + + posts.forEach(post => { + // Clone the date object to avoid pollution + let date = post.date.clone(); + + if (timezone) date = date.tz(timezone); + if (lang) date = date.locale(lang); + + const year = date.year(); + const month = date.month() + 1; + const name = date.format(format); + const lastData = data[length - 1]; + + if (!lastData || lastData.name !== name) { + length = data.push({ + name, + year, + month, + count: 1 + }); + } else { + lastData.count++; + } + }); + + const link = item => { + let url = `${archiveDir}/${item.year}/`; + + if (type === 'monthly') { + if (item.month < 10) url += '0'; + url += `${item.month}/`; + } + + return this.url_for(url); + }; + + if (style === 'list') { + result += `'; + } else { + for (let i = 0, len = data.length; i < Math.min(len, limit); i++) { + const item = data[i]; + + if (i) result += separator; + + result += ``; + result += transform ? transform(item.name) : item.name; + + if (showCount) { + result += `${item.count}`; + } + + result += ''; + } + if (data.length > limit) { + result += ``; + result += more_button; + result += ''; + } + + } + + return result; +}) \ No newline at end of file diff --git a/scripts/random_cover.js b/scripts/random_cover.js index 75a64eb..daa7b3f 100644 --- a/scripts/random_cover.js +++ b/scripts/random_cover.js @@ -1,4 +1,9 @@ -hexo.extend.helper.register('random_cover', function () { +hexo.extend.filter.register('before_post_render', function(data){ + data.cover = data.cover || random_cover() + return data; +}); + +var random_cover = function () { var cover; var num; if (!Array.isArray(hexo.theme.config.default_cover)) { @@ -10,4 +15,4 @@ hexo.extend.helper.register('random_cover', function () { return cover } -}) \ No newline at end of file +} \ No newline at end of file diff --git a/scripts/related_post.js b/scripts/related_post.js index 1d7f514..2349c10 100644 --- a/scripts/related_post.js +++ b/scripts/related_post.js @@ -44,7 +44,7 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) { for (var i = 0; i < Math.min(relatedPosts.length, limit_num); i++) { - var cover = relatedPosts[i].cover || random_cover() + var cover = relatedPosts[i].cover result += '