From e977dc9145af75cbc746ffd78c4b2aa160e1a63e Mon Sep 17 00:00:00 2001 From: Hider Joo Date: Sun, 12 May 2024 01:07:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=89=AF=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E4=B8=BA=E5=88=97=E8=A1=A8=EF=BC=8C=E6=AF=8F?= =?UTF-8?q?=E6=AC=A1=E9=9A=8F=E6=9C=BA=E9=80=89=E6=8B=A9=E4=B8=80=E9=A1=B9?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hider Joo --- layout/_partials/header/banner.ejs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/layout/_partials/header/banner.ejs b/layout/_partials/header/banner.ejs index a8c554df..93b2b7d3 100644 --- a/layout/_partials/header/banner.ejs +++ b/layout/_partials/header/banner.ejs @@ -3,6 +3,10 @@ var banner_img = page.banner_img || theme.index.banner_img var banner_img_height = parseFloat(page.banner_img_height || theme.index.banner_img_height) var banner_mask_alpha = parseFloat(page.banner_mask_alpha || theme.index.banner_mask_alpha) var subtitle = page.subtitle || page.title +// 如果subtitle是数组,就将其自己赋值为其自己的其中随机一个元素 +if (Array.isArray(subtitle)) { + subtitle = subtitle[Math.floor(Math.random() * subtitle.length)] +} %>