From 750bbf8b19f3905204acf9752976e97519eb6743 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Wed, 17 Jan 2024 23:39:14 +0800 Subject: [PATCH] [opt] menubar --- _config.yml | 31 ++++++++++++++++------ layout/_partial/main/navbar/breadcrumb.ejs | 12 +++------ layout/_partial/sidebar/menu.ejs | 7 +++-- source/css/_layout/sidebar/menu.styl | 2 +- source/css/_layout/widgets/toc_wiki.styl | 4 +-- 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/_config.yml b/_config.yml index 5d23ea9..333a957 100755 --- a/_config.yml +++ b/_config.yml @@ -25,14 +25,29 @@ logo: subtitle: '' # '文字1 | 文字2' (鼠标放上去会切换到文字2) # 侧边栏主功能导航菜单 -# 自己可以增加任意的键值对 -# 键:就是 menu_id,后面需要用到 -# 值:就是显示的 md 链接,方括号内支持文字和图片标签 -menu: - # post: '[btn.blog](/)' - # wiki: '[btn.wiki](/wiki/)' - # friends: '[友链](/friends/)' - # about: '[关于](/about/)' +menubar: + columns: 4 # 一行多少个 + items: # 可按照自己需求增加,符合以下格式即可 + # - id: post + # theme: '#1BCDFC' + # icon: '' + # title: 博客 + # url: / + # - id: wiki + # theme: '#3DC550' + # icon: '' + # title: 项目 + # url: /wiki/ + # - id: notes + # theme: '#FA6400' + # icon: '' + # title: 探索 + # url: /notes/ + # - id: social + # theme: '#F44336' + # icon: '' + # title: 社交 + # url: /friends/ ######## Main ######## diff --git a/layout/_partial/main/navbar/breadcrumb.ejs b/layout/_partial/main/navbar/breadcrumb.ejs index e6c3846..671ea9c 100644 --- a/layout/_partial/main/navbar/breadcrumb.ejs +++ b/layout/_partial/main/navbar/breadcrumb.ejs @@ -95,15 +95,9 @@ function layoutDiv() { nodes.push('/'); // menu_id el += ''; - if (page.menu_id && theme.menu[page.menu_id]?.url) { - let url = url_for(theme.menu[page.menu_id]?.url); - nodes.push(url); - el += '' + __(theme.menu[page.menu_id]?.title) + ''; - } else { - let url = url_for(theme.site_tree.wiki.base_dir); - nodes.push(url); - el += '' + __("btn.wiki") + ''; - } + let url = url_for(theme.site_tree.wiki.base_dir); + nodes.push(url); + el += '' + __("btn.wiki") + ''; // 项目名 let proj = theme.wiki.tree[page.wiki]; if (proj != null) { diff --git a/layout/_partial/sidebar/menu.ejs b/layout/_partial/sidebar/menu.ejs index ec96834..bfc59cb 100644 --- a/layout/_partial/sidebar/menu.ejs +++ b/layout/_partial/sidebar/menu.ejs @@ -2,12 +2,11 @@ function layoutDiv() { var el = '' el += `