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 += '
';
diff --git a/layout/_partial/sidebar/index.ejs b/layout/_partial/sidebar/index.ejs
index 99b2890..f81ff51 100755
--- a/layout/_partial/sidebar/index.ejs
+++ b/layout/_partial/sidebar/index.ejs
@@ -9,7 +9,7 @@ if (page.sidebar == null) {
} else if (page.layout === 'index_topic') {
// 专栏列表页等同于博客列表页
sidebar = site_tree.blog.sidebar
- } else if (page.layout === 'topic') {
+ } else if (page.topic?.length > 0) {
sidebar = site_tree.topic.sidebar
} else if (page.layout === 'index_wiki' || page.layout === 'wiki') {
sidebar = site_tree.wiki.sidebar
@@ -25,7 +25,7 @@ if (page.sidebar == null) {
sidebar = []
}
- if (page.layout === 'topic' && page.topic && theme.topic?.tree[page.topic]?.sidebar) {
+ if (page.topic && theme.topic?.tree[page.topic]?.sidebar) {
sidebar = theme.topic.tree[page.topic].sidebar
}
if (page.layout == 'wiki' && page.wiki && theme.wiki?.tree[page.wiki]?.sidebar) {
@@ -133,7 +133,7 @@ function layoutNavArea() {
if (proj.search) {
search = proj.search
}
- } else if (page.topic && page.layout == 'topic' && theme.topic.tree[page.topic]) {
+ } else if (page.topic && theme.topic.tree[page.topic]) {
const topic = theme.topic.tree[page.topic]
if (topic.search) {
search = topic.search
diff --git a/layout/_partial/sidebar/logo.ejs b/layout/_partial/sidebar/logo.ejs
index 1389d5e..a6161d0 100644
--- a/layout/_partial/sidebar/logo.ejs
+++ b/layout/_partial/sidebar/logo.ejs
@@ -14,7 +14,7 @@ if (page.logo) {
subtitle: proj.subtitle
}
}
-} else if (page.topic && page.layout == 'topic' && theme.topic.tree[page.topic]) {
+} else if (page.topic && theme.topic.tree[page.topic]) {
const topic = theme.topic.tree[page.topic]
var l = topic.logo
if (l) {
diff --git a/layout/_partial/widgets/related.ejs b/layout/_partial/widgets/related.ejs
index 2caf5e0..1cce2e6 100644
--- a/layout/_partial/widgets/related.ejs
+++ b/layout/_partial/widgets/related.ejs
@@ -55,9 +55,9 @@ function relatedWiki() {
return el
}
function layoutDiv() {
- if (page.layout == 'wiki') {
+ if (page.wiki?.length > 0) {
return relatedWiki()
- } else if (page.layout == 'topic') {
+ } else if (page.topic?.length > 0) {
return relatedPostsInTopic()
}
}
diff --git a/layout/layout.ejs b/layout/layout.ejs
index 2377714..c0cc3cd 100755
--- a/layout/layout.ejs
+++ b/layout/layout.ejs
@@ -1,20 +1,39 @@
<%
+// 页面类型:索引页面还是内容页面
var page_type = 'index'
-if (['post', 'page', 'wiki', 'topic', null].includes(page.layout)) {
+if (['post', 'page', 'wiki', null].includes(page.layout)) {
if (!page.nav_tabs) {
page_type = 'content'
}
}
+// 文章类型:技术类文章/文学类文章
+var article_type = theme.article.type
+if (page.type?.length > 0) {
+ article_type = page.type
+}
+// 是否缩进
+var indent = false
+if (page.indent != null) {
+ indent = page.indent
+} else if (page.topic && theme.topic.tree[page.topic] && (theme.topic.tree[page.topic].indent != null)) {
+ indent = theme.topic.tree[page.topic].indent
+} else if (page.wiki && theme.wiki.tree[page.wiki] && (theme.wiki.tree[page.wiki].indent != null)) {
+ indent = theme.wiki.tree[page.wiki].indent
+} else if (theme.article.indent) {
+ indent = theme.article.indent
+} else {
+ indent = article_type === 'story'
+}
var html = ``
html += ``
html += partial('_partial/head')
html += ``
html += partial('_partial/cover/index')
- html += `
`
+ html += `
`
html += `