From ec2345e4f3cf4563e8cb687b03d5fb7a4508ff70 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Mon, 2 Aug 2021 19:23:50 +0800 Subject: [PATCH] update sidebar --- _config.yml | 14 +++++++++++--- layout/_partial/sidebar/index.ejs | 4 +++- source/css/_common/highlight.styl | 11 +++++++++++ source/css/_layout/md.styl | 11 ----------- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/_config.yml b/_config.yml index cec9ba3..72a4ba8 100755 --- a/_config.yml +++ b/_config.yml @@ -26,7 +26,7 @@ sidebar: # Sidebar widgets widgets: # default layout in home/wiki/categories/tags/archives pages - default_layout: [welcome, recent] + default_layout: [welcome] # Recent update recent: layout: recent @@ -42,9 +42,17 @@ sidebar: # welcome welcome: layout: markdown - title: 欢迎 + title: Stellar 入门指南 content: - - '欢迎光临小站,[Stellar](https://github.com/xaoxuu/hexo-theme-stellar/) 是一个支持 wiki 的 hexo 主题,适合综合型站点使用。同时也拥有简约而精美的视觉设计和丰富的标签插件,帮助您简单从容地应对各种场合。' + - '欢迎使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar/) 主题,下面是您的入门指南,祝您使用愉快!' + - '
' + - '**第一步**' + - '创建 `blog/_config.stellar.yml` 文件,在此文件中填写需要自定义的主题配置。' + - '
' + - '**第二步**' + - '创建 `blog/source/_data/widgets.yml` 文件,此文件中填写需要自定义的侧边栏组件,例如 `welcome` 组件。' + - '
' + - '如果有任何疑问,请先查阅[文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。' diff --git a/layout/_partial/sidebar/index.ejs b/layout/_partial/sidebar/index.ejs index 8b137ee..5f3f4e9 100755 --- a/layout/_partial/sidebar/index.ejs +++ b/layout/_partial/sidebar/index.ejs @@ -21,7 +21,9 @@ function layoutWidgets() { page.sidebar.forEach((w, i) => { if (w in theme.sidebar.widgets) { let widget = theme.sidebar.widgets[w]; - el += partial('widgets/' + widget.layout, {item: widget}); + if (widget && widget.layout) { + el += partial('widgets/' + widget.layout, {item: widget}); + } } }); } diff --git a/source/css/_common/highlight.styl b/source/css/_common/highlight.styl index cc01255..773ae49 100644 --- a/source/css/_common/highlight.styl +++ b/source/css/_common/highlight.styl @@ -1,3 +1,14 @@ +code + -webkit-font-smoothing: auto + -moz-osx-font-smoothing: auto + color: var(--text-code) + font-family: $ff-code + word-break: break-all + font-size: 85% + background: var(--block) + padding: .2em .4em + border-radius: 4px + article.md .highlight margin: 1rem 0 border-radius: $border-block diff --git a/source/css/_layout/md.styl b/source/css/_layout/md.styl index b031dfd..bd60391 100644 --- a/source/css/_layout/md.styl +++ b/source/css/_layout/md.styl @@ -86,17 +86,6 @@ article.md article.md p font-size: $fs-p -// code -article.md code - -webkit-font-smoothing: auto - -moz-osx-font-smoothing: auto - color: var(--text-code) - font-family: $ff-code - word-break: break-all - font-size: 85% - background: var(--block) - padding: .2em .4em - border-radius: 4px article.md pre -webkit-font-smoothing: auto -moz-osx-font-smoothing: auto