mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
support asset_folder for pagination_cover yaml
This commit is contained in:
@@ -34,7 +34,7 @@ hexo.extend.generator.register('post', locals => {
|
|||||||
|
|
||||||
const handleImg = data => {
|
const handleImg = data => {
|
||||||
const imgTestReg = /\.(png|jpe?g|gif|svg|webp|avif)(\?.*)?$/i
|
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
|
// Add path to top_img and cover if post_asset_folder is enabled
|
||||||
if (hexo.config.post_asset_folder) {
|
if (hexo.config.post_asset_folder) {
|
||||||
@@ -44,6 +44,9 @@ hexo.extend.generator.register('post', locals => {
|
|||||||
if (coverVal && coverVal.indexOf('/') === -1 && imgTestReg.test(coverVal)) {
|
if (coverVal && coverVal.indexOf('/') === -1 && imgTestReg.test(coverVal)) {
|
||||||
data.cover = `${data.path}${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
|
if (coverVal === false) return data
|
||||||
|
|||||||
Reference in New Issue
Block a user