mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
🐛 修復文章頁沒有lazyload的bugs
This commit is contained in:
parent
a7c3a8906a
commit
75f5e991d0
@ -11,5 +11,6 @@ const urlFor = require('hexo-util').url_for.bind(hexo)
|
||||
hexo.extend.filter.register('after_post_render', data => {
|
||||
if (!hexo.theme.config.lazyload.enable) return
|
||||
const bg = hexo.theme.config.lazyload.post ? urlFor(hexo.theme.config.lazyload.post) : 'data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs='
|
||||
return data.content.replace(/(<img.*? src=)/ig, `$1 "${bg}" data-lazy-src=`)
|
||||
data.content = data.content.replace(/(<img.*? src=)/ig, `$1 "${bg}" data-lazy-src=`)
|
||||
return data
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user