From 8e8b63169bdc6cd625e0a30ec8a808fba24c98a6 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Thu, 18 Jan 2024 22:11:58 +0800 Subject: [PATCH] [feat] article type --- _config.yml | 15 ++++++++++-- layout/_partial/main/article/read_next.ejs | 2 +- layout/_partial/main/navbar/breadcrumb.ejs | 2 +- layout/_partial/sidebar/index.ejs | 6 ++--- layout/_partial/sidebar/logo.ejs | 2 +- layout/_partial/widgets/related.ejs | 4 ++-- layout/layout.ejs | 27 +++++++++++++++++---- layout/page.ejs | 2 +- layout/post.ejs | 2 +- layout/topic.ejs | 28 ---------------------- layout/wiki.ejs | 2 +- scripts/generators/topic.js | 2 +- source/css/_common/highlight.styl | 4 ++-- source/css/_custom.styl | 11 +++++++-- source/css/_layout/md.styl | 23 +++++++++--------- source/css/_layout/sidebar/nav-area.styl | 2 +- source/css/_layout/sidebar/search.styl | 7 +++--- source/css/_layout/sidebar/sidebar.styl | 16 ++++++++----- source/css/_layout/tag-plugins/tabs.styl | 4 ++-- source/css/_layout/widgets/timeline.styl | 4 ++++ source/js/plugins/copycode.js | 6 ++--- 21 files changed, 95 insertions(+), 76 deletions(-) delete mode 100644 layout/topic.ejs diff --git a/_config.yml b/_config.yml index 333a957..dd9d3d6 100755 --- a/_config.yml +++ b/_config.yml @@ -95,6 +95,10 @@ site_tree: ######## Article ######## article: + # 文章类型,决定布局风格,可以在 front-matter/topic/wiki 中覆盖此参数 + type: tech # tech: 默认技术类文章, story: 图文类文章,文字和段落间增距大 + # 缩进两个文字宽度,适合文字类博客,可以在 front-matter/topic/wiki 中覆盖此参数 + indent: # true / false # 如果没有指定封面,是否根据 tags 作为关键词搜索封面图片? auto_cover: false # search from https://source.unsplash.com/ # 封面图宽高比 @@ -451,7 +455,7 @@ style: smooth_scroll: false # true / false 开启时如果目录过长可能无法准确定位 font-size: root: 16px - body: .9375rem # 15px + body: 1rem # 16px code: 85% # 14px codeblock: 0.8125rem # 13px font-family: @@ -491,6 +495,13 @@ style: gradient: # https://webgradients.com/ start: 'linear-gradient(to right, hsl(215, 95%, 64%), hsl(195, 95%, 60%), hsl(165, 95%, 56%), hsl(165, 95%, 56%), hsl(195 95% 60%), hsl(215, 95%, 64%))' search: 'linear-gradient(to right, #04F3FF, #08FFC6, #DDF730, #FFBD19, #FF1FE0, #C418FF, #04F3FF)' + sidebar: + # 可以设置:纯色/渐变色/图片作为背景 + # background: 'linear-gradient(to bottom, #abc3, #abc3)' + # background: 'linear-gradient(to bottom, #20E2D744, #F9FEA544)' + # 在图片上层增加高斯模糊效果(同时附带饱和度增强效果) + background: 'url(https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.13/image/sidebar-bg1@small.jpg)' + blur: true default: avatar: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/avatar/round/3442075.svg @@ -500,7 +511,7 @@ default: 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 - sidebar: https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.13/image/sidebar-bg1@small.jpg + api_host: ghapi: https://api.github.com diff --git a/layout/_partial/main/article/read_next.ejs b/layout/_partial/main/article/read_next.ejs index da93097..5daf668 100644 --- a/layout/_partial/main/article/read_next.ejs +++ b/layout/_partial/main/article/read_next.ejs @@ -4,7 +4,7 @@ function layoutDiv() { var title = __('meta.read_next') title_prev = __('meta.newer') title_next = __('meta.older') - if (page.layout === 'post' || page.layout === 'topic') { + if (page.layout === 'post') { prev = page.prev next = page.next } else if (page.layout === 'wiki' && page.wiki?.length > 0) { diff --git a/layout/_partial/main/navbar/breadcrumb.ejs b/layout/_partial/main/navbar/breadcrumb.ejs index 70c4694..0360fa3 100644 --- a/layout/_partial/main/navbar/breadcrumb.ejs +++ b/layout/_partial/main/navbar/breadcrumb.ejs @@ -54,7 +54,7 @@ function layoutDiv() { el += ''; el += ''; - } else if (page.layout === 'topic' && page.topic?.length > 0) { + } else if (page.topic?.length > 0) { el += '
'; el += '
'; el += '