From eb4835db17d32ce8bc9eb0c393730bd3b2674941 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Sat, 28 Aug 2021 13:08:53 +0800 Subject: [PATCH] custom breadcrumb --- _config.yml | 6 +++++- layout/_partial/main/navbar/breadcrumb.ejs | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/_config.yml b/_config.yml index a713642..e03e29a 100755 --- a/_config.yml +++ b/_config.yml @@ -56,6 +56,10 @@ sidebar: +######## Main ######## +breadcrumb: + home: config.title # config.title / config.author / home or custom content + ######## Article ######## article: # 如果没有指定封面,是否根据 tags 作为关键词搜索封面? @@ -230,7 +234,7 @@ style: darkmode: auto # set 'auto' to enable, set 'false' to disable theme: light: '#f8f8f8' - dark: '#20252B' + dark: '#202429' animated_avatar: animate: auto # auto, always background: https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.2/avatar/round/rainbow64@3x.webp diff --git a/layout/_partial/main/navbar/breadcrumb.ejs b/layout/_partial/main/navbar/breadcrumb.ejs index 88ca063..8061013 100644 --- a/layout/_partial/main/navbar/breadcrumb.ejs +++ b/layout/_partial/main/navbar/breadcrumb.ejs @@ -4,6 +4,16 @@ function layoutDiv() { if (page.breadcrumb === false) { return el; } + var home_title = __("btn.home"); + if (theme.breadcrumb && theme.breadcrumb.home) { + if (theme.breadcrumb.home === 'config.title') { + home_title = config.title; + } else if (theme.breadcrumb.home === 'config.author') { + home_title = config.author; + } else if (theme.breadcrumb.home !== 'home') { + home_title = theme.breadcrumb.home; + } + } if (page.layout === "post") { var firstCat = ""; if (page.categories && page.categories.length > 0) { @@ -11,9 +21,9 @@ function layoutDiv() { } el += '
'; el += '