From 254c29c6febf095410c437d81e314f9577a016c6 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Fri, 26 Feb 2021 20:02:32 +0800 Subject: [PATCH] update --- _config.yml | 4 +- languages/en.yml | 8 ++-- languages/zh-CN.yml | 10 +++-- languages/zh-TW.yml | 10 +++-- layout/_partial/head.ejs | 12 ++++++ layout/_partial/main/article/references.ejs | 8 ++-- layout/_partial/main/post_list/paginator.ejs | 6 +-- layout/archive.ejs | 2 +- layout/categories.ejs | 2 +- layout/index.ejs | 30 +++++++++++--- layout/tags.ejs | 2 +- layout/wiki.ejs | 2 +- scripts/tags/timeline.js | 39 +++++++++++++----- source/css/_custom.styl | 1 + source/css/_layout/layout.styl | 2 + .../css/_layout/partial/article_footer.styl | 14 +++++-- source/css/_layout/partial/paginator.styl | 33 ++++++++++----- source/css/_layout/post_list.styl | 7 ++-- source/css/_layout/tag-plugins/timeline.styl | 40 +++++++++---------- 19 files changed, 154 insertions(+), 78 deletions(-) diff --git a/_config.yml b/_config.yml index 049ae7d..99f64ab 100755 --- a/_config.yml +++ b/_config.yml @@ -55,7 +55,7 @@ article: category_color: '新闻稿': '#DA0F47' # 文章许可协议 - license: '本文采用 [署名-非商业性使用-相同方式共享 4.0 国际](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh) 许可协议,转载请注明出处。' + license: '本文采用 [署名-非商业性使用-相同方式共享 4.0 国际](https://creativecommons.org/licenses/by-nc-sa/4.0/) 许可协议,转载请注明出处。' # 分享 share: # [weibo, email, link] # wechat 需要安装二维码插件: npm i hexo-helper-qrcode # 相关文章,需要安装插件 (for layout: post) @@ -145,7 +145,7 @@ plugins: # https://scrollrevealjs.org/api/reveal.html scrollreveal: - enable: #true + enable: true js: https://cdn.jsdelivr.net/npm/scrollreveal@4.0.7/dist/scrollreveal.min.js distance: 8px duration: 500 # ms diff --git a/languages/en.yml b/languages/en.yml index 892a39a..2d3cdf8 100755 --- a/languages/en.yml +++ b/languages/en.yml @@ -43,9 +43,11 @@ page: what: Page Not Found why: The address may be entered incorrectly or the address has been deleted. action: Back to Home - categories: '%s Categories' - tags: '%s Tags' - archives: '%s Years, %s Archives' + categories: "%s's %s has %s categories" + tags: "%s's %s has %s tags" + archives: "%s in %s years wrote %s articles" # 不知道如何把参数顺序调一下 + filter: "%s's %s has %s articles" + wiki: "%s has %s %s in total" symbol: comma: ", " diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index 989e6bd..54a51e5 100755 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -2,7 +2,7 @@ btn: home: 主页 blog: 文章 wiki: 项目 - recent_publish: 最新发布 + recent_publish: 近期发布 all_wiki: 所有项目 category: 分类 categories: 分类 @@ -43,9 +43,11 @@ page: what: 很抱歉,您访问的页面不存在 why: 可能是输入地址有误或该地址已被删除 action: 返回主页 - categories: '共%s个分类' - tags: '共%s个标签' - archives: 'TA在%s年间写了%s篇文章' + categories: '%s的%s共有%s个分类' + tags: '%s的%s共有%s个标签' + archives: '%s在%s年间写了%s篇文章' + filter: '%s的%s共有%s篇文章' + wiki: '%s共有%s个%s' symbol: comma: "," diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml index 8fde514..fb068d2 100755 --- a/languages/zh-TW.yml +++ b/languages/zh-TW.yml @@ -2,7 +2,7 @@ btn: home: 主頁 blog: 博客 wiki: 項目 - recent_publish: 最新發布 + recent_publish: 近期發布 all_wiki: 所有項目 category: 分類 categories: 分類 @@ -43,9 +43,11 @@ page: what: 很抱歉,您訪問的頁面不存在 why: 可能是輸入地址有誤或該地址已被刪除 action: 返回主頁 - categories: '共%s個分類' - tags: '共%s個標籤' - archives: 'TA在%s年間寫了%s篇文章' + categories: '%s的%s共有%s個分類' + tags: '%s的%s共有%s個標籤' + archives: '%s在%s年間寫了%s篇文章' + filter: '%s的%s共有%s篇文章' + wiki: '%s共有%s个%s' symbol: comma: "," diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs index 2ee029f..e3499e0 100755 --- a/layout/_partial/head.ejs +++ b/layout/_partial/head.ejs @@ -13,6 +13,17 @@ function generate_title() { } return ''; } +function generate_description() { + // 索引页 + if (theme.open_graph && theme.open_graph.enable) { + return ''; + } + if (page.description || page.excerpt || page.content) { + return ''; + } + return ''; +} + function generate_robots() { if (is_home() == true) { return ''; @@ -53,6 +64,7 @@ function og_args() { <% if (theme.open_graph && theme.open_graph.enable) { %> <%- open_graph(og_args()) %> <% } %> + <%- generate_description() %> <% if (config.feed && config.feed.path) { %> diff --git a/layout/_partial/main/article/references.ejs b/layout/_partial/main/article/references.ejs index 6cec712..77b71e7 100644 --- a/layout/_partial/main/article/references.ejs +++ b/layout/_partial/main/article/references.ejs @@ -46,9 +46,9 @@ function layoutDiv() { if (['wechat', 'weibo', 'email', 'link'].includes(item)) { el += ''; el += ''; } diff --git a/layout/_partial/main/post_list/paginator.ejs b/layout/_partial/main/post_list/paginator.ejs index 6982cdb..6d5a6a0 100644 --- a/layout/_partial/main/post_list/paginator.ejs +++ b/layout/_partial/main/post_list/paginator.ejs @@ -1,13 +1,13 @@ <% if (is_home() && page.total > 1) { %>
- +
- <%- page.current %> / <%- page.total %> + <%- page.current %><%- page.total %>
- +
<% } %> diff --git a/layout/archive.ejs b/layout/archive.ejs index de5202e..6bacbda 100755 --- a/layout/archive.ejs +++ b/layout/archive.ejs @@ -17,7 +17,7 @@ if (page.menu_id == undefined) { <% years.push(post.year); %> <% } %> <% }); %> -
<%- __('page.archives', years.length, site.posts.length) %>
+

<%- __('page.archives', config.title, years.length, site.posts.length) %>

<% years.forEach((year, i) => { %>
<%= year %>
diff --git a/layout/categories.ejs b/layout/categories.ejs index 828c080..ef0b7d5 100755 --- a/layout/categories.ejs +++ b/layout/categories.ejs @@ -9,7 +9,7 @@ if (page.menu_id == undefined) { <% page.layout = 'categories'; %> <%- partial('_partial/main/navbar/list_post') %>
-
<%- __('page.categories', site.categories.length) %>
+

<%- __('page.categories', config.title, __('btn.blog'), site.categories.length) %>

<% site.categories.sort('path').each(function(category){ %>
diff --git a/layout/index.ejs b/layout/index.ejs index 0949a09..a86280e 100755 --- a/layout/index.ejs +++ b/layout/index.ejs @@ -9,11 +9,21 @@ if (page.menu_id == undefined) { if (page.title && page.wiki) { page.robots = 'noindex,follow'; } +function layout_h1() { + if (is_home()) { + return ''; + } + var el = '

'; + el += __('page.filter', config.title, page.category || page.tag, page.posts.length); + el += '

'; + return el; +} %> <% if (page.menu_id == 'post') { %> <%- partial('_partial/main/navbar/list_post') %> <% if (page.posts) { %>
+ <%- layout_h1() %> <% page.posts.each(function(post){ %>
@@ -35,12 +45,19 @@ if (page.title && page.wiki) { <%- partial('_partial/main/navbar/list_wiki') %> <% if (page.title && page.wiki) { %>
- <% page.wiki.forEach((wiki, i) => { %> - <% site.pages.filter(function (p) { %> - <% return p.layout == 'wiki' && p.wiki == wiki && p.description; %> - <% }).limit(1).each(function(post) { %> - <%- outputExcerpt(post) %> - <% }); %> + <% + var wikis = []; + page.wiki.forEach((wiki, i) => { + site.pages.filter(function (p) { + return p.layout == 'wiki' && p.wiki == wiki && p.description; + }).limit(1).each(function(post) { + wikis.push(post); + }); + }); + %> +

<%- __('page.wiki', config.title, wikis.length, page.title) %>

+ <% wikis.forEach(function(post) { %> + <%- outputExcerpt(post) %> <% }); %>
<% } else { %> @@ -58,6 +75,7 @@ if (page.title && page.wiki) { } }).sort('order'); %> +

<%- __('page.wiki', config.title, wikis.length, __('btn.wiki')) %>

<% wikis.forEach(function(post) { %> <%- outputExcerpt(post) %> <% }); %> diff --git a/layout/tags.ejs b/layout/tags.ejs index 5681689..77f840d 100755 --- a/layout/tags.ejs +++ b/layout/tags.ejs @@ -9,7 +9,7 @@ if (page.menu_id == undefined) { <% page.layout = 'tags'; %> <%- partial('_partial/main/navbar/list_post') %>
-
<%- __('page.tags', site.tags.length) %>
+

<%- __('page.tags', config.title, __('btn.blog'), site.tags.length) %>

<% site.tags.sort('length', -1).each(function(tag){ %> diff --git a/layout/wiki.ejs b/layout/wiki.ejs index 253021e..2ac1294 100755 --- a/layout/wiki.ejs +++ b/layout/wiki.ejs @@ -6,7 +6,7 @@ if (page.layout == undefined) { page.layout = 'index'; } if (page.title == undefined) { - page.title = 'Wiki'; + page.title = __('btn.wiki'); } function layoutTitle() { const title = page.h1 || page.title; diff --git a/scripts/tags/timeline.js b/scripts/tags/timeline.js index c20abaf..7f77da5 100644 --- a/scripts/tags/timeline.js +++ b/scripts/tags/timeline.js @@ -1,27 +1,46 @@ /** * timeline.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/ - * - * {% timeline %} - * + * + * {% timeline [order:-date] %} + * * {% timenode header1 %} * what happened 1 * {% endtimenode %} - * + * * {% timenode header2 %} * what happened 2 * {% endtimenode %} - * + * * {% endtimeline %} */ 'use strict'; +const { ArgsMap, ArgsJoinTags } = require('./utils'); + function postTimeline(args, content) { - return `
- -${content} - -
`; + args = ArgsMap(args, ['order']); + + const newerIcon = ''; + + const olderIcon = ''; + + var el = ''; + const order = args && args.order == 'date' ? 'date' : '-date'; + el += '
'; + if (order == '-date') { + el += newerIcon; + } else { + el += olderIcon; + } + el += '
' + content + '
'; + if (order == '-date') { + el += olderIcon; + } else { + el += newerIcon; + } + el += '
'; + return el; } function postTimenode(args, content) { diff --git a/source/css/_custom.styl b/source/css/_custom.styl index 36cc419..2b686f1 100644 --- a/source/css/_custom.styl +++ b/source/css/_custom.styl @@ -61,6 +61,7 @@ $sidebar = 280px // max body width $layout-max-body-width = 680px +$layout-max-body-width-2k = 720px // gap $gap = 16px // 必须是 px diff --git a/source/css/_layout/layout.styl b/source/css/_layout/layout.styl index 9b4fed6..dc4e01e 100644 --- a/source/css/_layout/layout.styl +++ b/source/css/_layout/layout.styl @@ -18,6 +18,8 @@ flex-grow: 1 width: 320px max-width: $layout-max-body-width + @media screen and (min-width: $device-2k) + max-width: $layout-max-body-width-2k footer margin-top: 4rem margin-bottom: 2rem diff --git a/source/css/_layout/partial/article_footer.styl b/source/css/_layout/partial/article_footer.styl index 75734fc..b639420 100644 --- a/source/css/_layout/partial/article_footer.styl +++ b/source/css/_layout/partial/article_footer.styl @@ -12,9 +12,12 @@ .body input.copy-area margin: 0.75rem 0 + padding: 0 width: 100% font-family: $ff-code font-size: $fs12 + font-weight: 600 + color: var(--text-p3) p font-size: $fs14 color: var(--text-p2) @@ -37,11 +40,14 @@ border-top: 1px solid var(--block-border) .md .article-footer .social-wrap - grid-gap: $gap * 0.25 $gap * 0.5 - grid-template-columns: repeat(auto-fill, 40px) - margin-bottom: 0.5rem + grid-gap: $gap * 0.5 $gap * 1.5 + grid-template-columns: repeat(auto-fill, 24px) + margin: 0.5rem 0 a.social - padding: 8px + padding: 0 + background: none + &:hover + box-shadow: none .md .article-footer .qrcode margin: 2rem auto 1rem diff --git a/source/css/_layout/partial/paginator.styl b/source/css/_layout/partial/paginator.styl index 826821b..fd03467 100644 --- a/source/css/_layout/partial/paginator.styl +++ b/source/css/_layout/partial/paginator.styl @@ -3,20 +3,33 @@ justify-content: space-between align-items: center disable-select() - font-weight: 500 - svg.icon - font-size: 1.8rem + font-size: 1rem + font-weight: 700 + background: var(--block) + border-radius: $border-card + border: 1px solid var(--block-border) + overflow: hidden .paginator text-align: center - padding: $gap - div.paginator - font-size: $fs14 - color: var(--text-p2) + .current + font-family: $ff-code + color: var(--text-p3) a.paginator - color: $color-link - trans1: color + color: var(--text-p3) + padding: 1rem + line-height: 0 + img + height: 1rem + filter: grayscale(100%) &.disable pointer-events: none opacity: 0.25 + &.prev + border-right: 1px solid transparent + &.next + border-left: 1px solid transparent a.paginator:hover - color: $color-hover + background: var(--card) + border-color: var(--block-border) + img + filter: grayscale(0%) diff --git a/source/css/_layout/post_list.styl b/source/css/_layout/post_list.styl index 1f4ae90..28f0c31 100644 --- a/source/css/_layout/post_list.styl +++ b/source/css/_layout/post_list.styl @@ -2,14 +2,15 @@ .post-list margin: 1rem .card-title,.list-title - font-weight: 600 - color: var(--text-meta) + color: var(--text-p3) font-family: $ff-code line-height: 1.2 .list-title + font-weight: 500 margin: 2rem 1rem 0rem - font-size: 1.5rem + font-size: 1.2rem .card-title + font-weight: 600 padding-bottom: 0.5rem font-size: 1.2rem diff --git a/source/css/_layout/tag-plugins/timeline.styl b/source/css/_layout/tag-plugins/timeline.styl index 02baaec..c1e9972 100644 --- a/source/css/_layout/tag-plugins/timeline.styl +++ b/source/css/_layout/tag-plugins/timeline.styl @@ -1,4 +1,4 @@ -div.timeline +.tag-plugin.timeline position: relative display: block margin: 1rem 0 @@ -13,32 +13,32 @@ div.timeline left: 16px top: 1rem bottom: 1rem - svg.top, svg.bottom + >svg.icon:first-child, >svg.icon:last-child position: absolute z-index: 1 fill: var(--block-border) height 16px width: 16px margin-left: 9px - svg.top + >svg.icon:first-child margin-top: -1rem - svg.bottom + >svg.icon:last-child margin-bottom: 1rem -div.timenode +.tag-plugin.timenode position: relative background: var(--card) - border: 1px solid var(--block-border) + border: 1px solid var(--theme) border-radius: $border-block margin-top: 1rem margin-bottom: 1rem font-size: $fs14 .header line-height: 1.2 - background: var(--block) + background: var(--theme-bg) border-top-left-radius: "calc(%s - 1px)" % $border-block border-top-right-radius: "calc(%s - 1px)" % $border-block - border-bottom: 1px solid var(--block-border) + border-bottom: 1px solid var(--theme) display: flex justify-content: space-between align-items: center @@ -64,19 +64,17 @@ div.timenode li font-size: $fs14 -div.timenode:hover +.tag-plugin.timenode:hover .header a visibility: visible -// div.timeline:hover -// &:before -// background: var(--block-border) -// svg.top, svg.bottom -// fill: var(--block-border) -// div.timenode:hover -// border-color: var(--block-border) -// .header -// background: var(--block-border) -// border-color: var(--block-border) -// a -// visibility: visible +.tag-plugin.timeline .timenode + --theme-bg: alpha(#888, 0.05) + +.tag-plugin.timeline[order='-date'] .timenodes>.timenode:first-child + --theme: alpha($c-blue, 0.25) + --theme-bg: alpha($c-blue, 0.05) + +.tag-plugin.timeline[order='date'] .timenodes>:last-child + --theme: alpha($c-blue, 0.25) + --theme-bg: alpha($c-blue, 0.05)