From a60b1cbfb75c6f5d80498d66f855078bfcc4f8d3 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Sat, 3 Feb 2024 14:38:34 +0800 Subject: [PATCH] [opt] banner --- layout/_partial/main/navbar/article_banner.ejs | 11 +++++++++-- layout/layout.ejs | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/layout/_partial/main/navbar/article_banner.ejs b/layout/_partial/main/navbar/article_banner.ejs index 3a24d0c..fe9d49f 100644 --- a/layout/_partial/main/navbar/article_banner.ejs +++ b/layout/_partial/main/navbar/article_banner.ejs @@ -1,6 +1,13 @@ <% -var banner_url = page.banner || '' +var banner_url +if (page.banner) { + banner_url = page.banner +} else if (theme.topic.tree[page.topic]?.banner != null) { + banner_url = theme.topic.tree[page.topic]?.banner +} else if (theme.wiki.tree[page.wiki]?.banner != null) { + banner_url = theme.wiki.tree[page.wiki]?.banner +} function layoutTitle() { const title = page.h1 != null ? page.h1 : page.title @@ -35,7 +42,7 @@ function layoutDiv() { var style = `` var el = `` el += `