support asset_folder for pagination_cover yaml

This commit is contained in:
Void4m0n
2025-11-25 21:37:48 +01:00
parent 586805ceb2
commit bb7b206369

View File

@@ -34,7 +34,7 @@ hexo.extend.generator.register('post', locals => {
const handleImg = data => {
const imgTestReg = /\.(png|jpe?g|gif|svg|webp|avif)(\?.*)?$/i
let { cover: coverVal, top_img: topImg } = data
let { cover: coverVal, top_img: topImg, pagination_cover: paginationCover } = data
// Add path to top_img and cover if post_asset_folder is enabled
if (hexo.config.post_asset_folder) {
@@ -44,6 +44,9 @@ hexo.extend.generator.register('post', locals => {
if (coverVal && coverVal.indexOf('/') === -1 && imgTestReg.test(coverVal)) {
data.cover = `${data.path}${coverVal}`
}
if (paginationCover && paginationCover.indexOf('/') === -1 && imgTestReg.test(paginationCover)) {
data.pagination_cover = `${data.path}${paginationCover}`
}
}
if (coverVal === false) return data