fix: 修復 pagination UI 顯示異常的 bug

fix: 修復 footer_img 配置不生效的 bug
improvement: 優化 背景url 的判斷
feat: 背景圖片配置不再需要添加 url()
This commit is contained in:
Jerry
2024-08-05 16:04:05 +08:00
Unverified
parent 06f543ed96
commit 48212b9610
7 changed files with 43 additions and 43 deletions

View File

@@ -1,43 +1,41 @@
-
const returnTopImg = img => img !== false ? img || theme.default_top_img : false
const isFixedClass = theme.nav.fixed ? ' fixed' : ''
var top_img = false
let headerClassName = 'not-top-img'
var bg_img = ''
if !theme.disable_top_img && page.top_img !== false
if is_post()
- var top_img = page.top_img || page.cover || theme.default_top_img
- top_img = page.top_img || page.cover || theme.default_top_img
else if is_page()
- var top_img = page.top_img || theme.default_top_img
- top_img = page.top_img || theme.default_top_img
else if is_tag()
- var top_img = theme.tag_per_img && theme.tag_per_img[page.tag]
- top_img = top_img ? top_img : (theme.tag_img !== false ? theme.tag_img || theme.default_top_img : false)
- top_img = theme.tag_per_img && theme.tag_per_img[page.tag]
- top_img = top_img || returnTopImg(theme.tag_img)
else if is_category()
- var top_img = theme.category_per_img && theme.category_per_img[page.category]
- top_img = top_img ? top_img : (theme.category_img !== false ? theme.category_img || theme.default_top_img : false)
- top_img = theme.category_per_img && theme.category_per_img[page.category]
- top_img = top_img || returnTopImg(theme.category_img)
else if is_home()
- var top_img = theme.index_img !== false ? theme.index_img || theme.default_top_img : false
- top_img = returnTopImg(theme.index_img)
else if is_archive()
- var top_img = theme.archive_img !== false ? theme.archive_img || theme.default_top_img : false
- top_img = returnTopImg(theme.archive_img)
else
- var top_img = page.top_img || theme.default_top_img
- top_img = page.top_img || theme.default_top_img
if top_img !== false
- var imgSource = top_img && isImgOrUrl(top_img) ? `background-image: url('${url_for(top_img)}')` : `background: ${top_img}`
- var bg_img = top_img ? imgSource : ''
- var site_title = page.title || page.tag || page.category || config.title
- var isHomeClass = is_home() ? 'full_page' : 'not-home-page'
- is_post() ? isHomeClass = 'post-bg' : isHomeClass
else
- var isHomeClass = 'not-top-img'
else
- var top_img = false
- var isHomeClass = 'not-top-img'
- bg_img = getBgPath(top_img)
- headerClassName = is_home() ? 'full_page' : 'not-home-page'
- headerClassName = is_post() ? 'post-bg' : headerClassName
- const isFixedClass = theme.nav.fixed ? ' fixed' : ''
header#page-header(class=`${isHomeClass+isFixedClass}` style=bg_img)
header#page-header(class=`${headerClassName+isFixedClass}` style=bg_img)
!=partial('includes/header/nav', {}, {cache: true})
if top_img !== false
if is_post()
include ./post-info.pug
else if is_home()
else if is_home()
#site-info
h1#site-title=site_title
h1#site-title=config.title
if theme.subtitle.enable
- var loadSubJs = true
#site-subtitle
@@ -49,4 +47,4 @@ header#page-header(class=`${isHomeClass+isFixedClass}` style=bg_img)
i.fas.fa-angle-down.scroll-down-effects
else
#page-site-info
h1#site-title=site_title
h1#site-title=page.title || page.tag || page.category