Skip to content

Commit

Permalink
增加副标题可以为列表,每次随机选择一项的功能
Browse files Browse the repository at this point in the history
Signed-off-by: Hider Joo <[email protected]>
  • Loading branch information
Hider Joo committed May 11, 2024
1 parent 2ebdb34 commit e977dc9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions layout/_partials/header/banner.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
}
%>

<div id="banner" class="banner" <%- theme.banner && theme.banner.parallax && 'parallax=true' %>
Expand Down

0 comments on commit e977dc9

Please sign in to comment.