diff --git a/_config.yml b/_config.yml index 98a7d7b..344ae09 100755 --- a/_config.yml +++ b/_config.yml @@ -16,6 +16,11 @@ open_graph: enable: true twitter_id: # for open_graph meta +# 只影响生成的页面路径,不影响配置文件命名规则 +base_dir: + wiki: wiki + topic: topic + author: author ######## Sidebar ######## sidebar: @@ -36,13 +41,17 @@ sidebar: blog_index: search_blog, recent, timeline # for categories/tags/archives # 文档索引页 wiki_index: search_docs, recent, timeline # for wiki + # 专栏索引页 + index_topic: search_blog, recent, timeline # for topic # 其它(404) others: search, recent, timeline # for 404 and ... #### 手动创建的页面 #### # 文章内页 post: search_blog, toc, related, ghrepo, ghissues # for pages using 'layout:post' + # 专栏内页 + topic: search_blog, toc, related # for pages using 'layout:wiki' # 文档内页 - wiki: search, toc, ghissues, related # for pages using 'layout:wiki' + wiki: search_blog, toc, ghissues, related # for pages using 'layout:wiki' # 其它 layout:page 的页面 page: toc, search # for custom pages using 'layout:page' @@ -189,16 +198,16 @@ comments: footer: social: # github: - # icon: '' + # icon: '' # url: / # music: - # icon: '' + # icon: '' # url: / # unsplash: - # icon: '' + # icon: '' # url: / # comments: - # icon: '' + # icon: '' # url: /about/#comments sitemap: # '博客': @@ -443,7 +452,7 @@ style: underline: true # true / false animated_avatar: animate: auto # auto, always - background: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/rainbow64@3x.webp + background: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/avatar/round/rainbow64@3x.webp codeblock: scrollbar: 4px highlightjs_theme: https://gcore.jsdelivr.net/gh/highlightjs/cdn-release@11.7.0/build/styles/atom-one-dark.min.css @@ -455,12 +464,13 @@ style: search: 'linear-gradient(to right, #04F3FF, #08FFC6, #DDF730, #FFBD19, #FF1FE0, #C418FF, #04F3FF)' default: - avatar: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/3442075.svg - link: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/link/8f277b4ee0ecd.svg - cover: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/cover/76b86c0226ffd.svg - image: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/image/2659360.svg - project: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/image/2779789.png - banner: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/banner/books.jpg + avatar: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/avatar/round/3442075.svg + link: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/link/8f277b4ee0ecd.svg + cover: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/cover/76b86c0226ffd.svg + image: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/image/2659360.svg + project: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/image/2779789.png + banner: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/banner/books.jpg + topic: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/image/10433048.png api_host: ghapi: https://api.github.com diff --git a/languages/en.yml b/languages/en.yml index 4421f00..219dfd9 100755 --- a/languages/en.yml +++ b/languages/en.yml @@ -2,6 +2,7 @@ btn: home: Home blog: Blog wiki: Wiki + topic: Topic recent_publish: Recent all_wiki: All Products category: Category @@ -24,7 +25,6 @@ meta: comment_title: Join the discussion back_to_top: Back to top more: 'More %s' - posts_in_category: 'Category: %s' created_author: '%s posted on' created: 'Posted on' updated: 'Updated on' diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index dc0d8a1..47af653 100755 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -2,6 +2,7 @@ btn: home: 主页 blog: 文章 wiki: 项目 + topic: 专栏 recent_publish: 近期发布 all_wiki: 所有项目 category: 分类 @@ -24,7 +25,6 @@ meta: comment_title: 快来参与讨论吧 back_to_top: 回到顶部 more: '更多「%s」' - posts_in_category: '专栏:%s' created_author: 本文由 %s 发布于 created: 发布于 updated: 更新于 diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml index 9128091..7f557d6 100755 --- a/languages/zh-TW.yml +++ b/languages/zh-TW.yml @@ -2,6 +2,7 @@ btn: home: 首頁 blog: 網誌 wiki: Wiki + topic: 專欄 recent_publish: 近期發布 all_wiki: 所有 Wiki category: 分類 @@ -24,7 +25,6 @@ meta: comment_title: 參與討論 back_to_top: 回到頁首 more: '更多「%s」' - posts_in_category: '專欄:%s' created_author: 本文由 %s 發布於 created: 發布於 updated: 更新於 diff --git a/layout/404.ejs b/layout/404.ejs index 2ed6f00..36004c4 100755 --- a/layout/404.ejs +++ b/layout/404.ejs @@ -6,7 +6,7 @@ page.header = 'auto'; page.robots = 'none'; %>
-

404

+

404

<%- __('page.error.what') %> diff --git a/layout/_partial/main/article/article_footer.ejs b/layout/_partial/main/article/article_footer.ejs index 0a91d90..64654a8 100644 --- a/layout/_partial/main/article/article_footer.ejs +++ b/layout/_partial/main/article/article_footer.ejs @@ -114,13 +114,13 @@ function layoutDiv() { } el += '>'; if (item == 'wechat') { - el += ''; + el += ''; } else if (item == 'weibo') { - el += ''; + el += ''; } else if (item == 'email') { - el += ''; + el += ''; } else if (item == 'link') { - el += ''; + el += ''; } el += ''; } diff --git a/layout/_partial/main/article/read_next.ejs b/layout/_partial/main/article/read_next.ejs index b025379..8067ee1 100644 --- a/layout/_partial/main/article/read_next.ejs +++ b/layout/_partial/main/article/read_next.ejs @@ -1,15 +1,31 @@ <% function layoutDiv() { - var prev,next; - var title = __('meta.read_next'); - var title_prev = __('meta.prev'); - var title_next = __('meta.next'); + var prev,next + var title = __('meta.read_next') + title_prev = __('meta.newer') + title_next = __('meta.older') if (page.layout === 'post') { - prev = page.prev; - next = page.next; - title_prev = __('meta.newer'); - title_next = __('meta.older'); - } else if (page.layout === 'wiki' && page.wiki && page.wiki.length > 0) { + prev = page.prev + next = page.next + } else if (page.layout === 'topic' && page.topic?.length > 0) { + const topicObject = theme.topic.tree[page.topic] + if (topicObject) { + const current_page_date = topicObject.pages.filter(p => p.path == page.path)[0].date + for (let p of topicObject.pages) { + if (p.date > current_page_date) { + if (prev == undefined || p.date < prev.date) { + prev = p + } + } else if (p.date < current_page_date) { + if (next == undefined || p.date > next.date) { + next = p + } + } + } + } + } else if (page.layout === 'wiki' && page.wiki?.length > 0) { + var title_prev = __('meta.prev'); + var title_next = __('meta.next'); let proj = theme.wiki.tree[page.wiki]; if (proj) { let ps = proj.pages?.filter(p => p.path == page.path) diff --git a/layout/_partial/main/navbar/breadcrumb.ejs b/layout/_partial/main/navbar/breadcrumb.ejs index 87f403c..34a04db 100644 --- a/layout/_partial/main/navbar/breadcrumb.ejs +++ b/layout/_partial/main/navbar/breadcrumb.ejs @@ -63,7 +63,38 @@ function layoutDiv() { el += ''; el += ''; - } else if (page.layout === "wiki" && page.wiki && page.wiki.length > 0) { + } else if (page.layout === 'topic' && page.topic?.length > 0) { + el += '

'; + el += '
'; + el += ''; + // 更新日期 + el += '
'; + el += ` + ${__("meta.updated")}  + `; + el += '
'; + el += '
'; + el += '
'; + } else if (page.layout === "wiki" && page.wiki?.length > 0) { el += '
'; el += '
'; el += ''; el += '
'; diff --git a/layout/_partial/main/post_list/topic_card.ejs b/layout/_partial/main/post_list/topic_card.ejs new file mode 100644 index 0000000..79b2348 --- /dev/null +++ b/layout/_partial/main/post_list/topic_card.ejs @@ -0,0 +1,16 @@ +<% +function layoutDiv() { + var el = ''; + el += '
'; + el += `
` + el += '
'; + el += '

' + (topic.title || topic.name) + '

'; + if (topic.description) { + el += '

' + topic.description + '

'; + } + el += '
'; + el += '
'; + return el; +} +%> +<%- layoutDiv() %> diff --git a/layout/_partial/sidebar/index.ejs b/layout/_partial/sidebar/index.ejs index 9761664..b30ed5e 100755 --- a/layout/_partial/sidebar/index.ejs +++ b/layout/_partial/sidebar/index.ejs @@ -1,8 +1,4 @@ <% -var proj; -if (page.layout === 'wiki' && page.wiki) { - proj = theme.wiki.tree[page.wiki]; -} // 默认组件 if (page.sidebar == undefined) { if (page.layout == 'post' && page.content) { @@ -14,6 +10,14 @@ if (page.sidebar == undefined) { } else { page.sidebar = theme.sidebar.widgets.wiki; } + } else if (page.layout === 'topic') { + if (page.topic && theme.topic?.tree[page.topic]?.sidebar) { + page.sidebar = theme.topic.tree[page.topic].sidebar; + } else { + page.sidebar = theme.sidebar.widgets.topic; + } + } else if (page.layout === 'index_topic') { + page.sidebar = theme.sidebar.widgets.index_topic } else if (is_home()) { page.sidebar = theme.sidebar.widgets.home; } else if (is_category() || is_tag() || is_archive() || ['categories', 'tags', 'archives'].includes(page.layout)) { @@ -60,6 +64,10 @@ function layoutWidgets() { el += __('btn.all_wiki'); el += ''; // this product + var proj; + if (page.layout === 'wiki' && page.wiki) { + proj = theme.wiki.tree[page.wiki]; + } if (proj == undefined) { // 如果没有项目名,则使用menu中显示的名字 if (page.menu_id && theme.sidebar.menu[page.menu_id] && md_link(theme.sidebar.menu[page.menu_id])) { diff --git a/layout/_partial/widgets/related.ejs b/layout/_partial/widgets/related.ejs index a902ed3..6733ebe 100644 --- a/layout/_partial/widgets/related.ejs +++ b/layout/_partial/widgets/related.ejs @@ -8,7 +8,7 @@ function relatedPosts() { var el = '' el += `` el += `
` - el += `${__('meta.posts_in_category', relatedItem.name)}` + el += `${__('btn.topic') + __('symbol.colon') + relatedItem.name}` el += `
` el += `