mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 13:07:06 +08:00
🐛 修復當博客root不是'/'時,引用本地圖片會顯示不出的bug close #211
This commit is contained in:
10
README.md
10
README.md
@@ -35,7 +35,15 @@ git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/Bu
|
||||
|
||||
## Documentation
|
||||
|
||||
Find in [hexo-theme-butterfly docs](https://docs.jerryc.me) and [JerryC](https://jerryc.me/posts/21cfbf15). it supports `zh-TW`
|
||||
Find in [hexo-theme-butterfly docs](https://docs.jerryc.me) and [JerryC](https://jerryc.me/posts/21cfbf15). it supports `zh-TW` and `zh-CN`
|
||||
|
||||
You can also join the Chat Group.
|
||||
|
||||
[ 💬 Join QQ Group [recommend]](https://jq.qq.com/?_wv=1027&k=5KI3Jqb)
|
||||
|
||||
[ 💬 Join Telegram Group](https://t.me/hexo_butterfly)
|
||||
|
||||
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
||||
@@ -36,7 +36,14 @@ theme: Butterfly
|
||||
|
||||
可查看[hexo-theme-butterfly docs](https://docs.jerryc.me) 和 [JerryC](https://jerryc.me/posts/21cfbf15)
|
||||
|
||||
你也可以加入群組
|
||||
|
||||
[ 💬 QQ群 [推薦]](https://jq.qq.com/?_wv=1027&k=5KI3Jqb)
|
||||
|
||||
[ 💬Telegram群](https://t.me/hexo_butterfly)
|
||||
|
||||
## 截圖
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- var top_img = theme.error_404.background || theme.default_top_img
|
||||
- var bg_img = `background-image: url(${top_img})`
|
||||
- var bg_img = `background-image: url(${url_for(top_img)})`
|
||||
|
||||
doctype html
|
||||
html(lang=config.language data-theme=theme.display_mode)
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
.md-links
|
||||
each item in i.link_list
|
||||
.md-links-item
|
||||
a(href=item.link title=item.name target="_blank")
|
||||
a(href=url_for(item.link) title=item.name target="_blank")
|
||||
if theme.lazyload.enable
|
||||
img.lazyload(data-src=item.avatar onerror=`this.onerror=null;this.src='` + url_for(theme.lodding_bg.flink) + `'` alt=item.name )
|
||||
img.lazyload(data-src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.lodding_bg.flink) + `'` alt=item.name )
|
||||
else
|
||||
img(src=item.avatar onerror=`this.onerror=null;this.src='` + url_for(theme.lodding_bg.flink) + `'` alt=item.name )
|
||||
img(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.lodding_bg.flink) + `'` alt=item.name )
|
||||
.md-links-title= item.name
|
||||
.md-links-des= item.descr
|
||||
!= page.content
|
||||
|
||||
@@ -19,7 +19,7 @@ if theme.douban
|
||||
else if is_current('/games/', [strict])
|
||||
- var top_img = theme.douban.games_img || theme.default_top_img
|
||||
|
||||
- var bg_img = top_img && top_img !== true ? `background-image: url(${top_img})` : ''
|
||||
- var bg_img = top_img && top_img !== true ? `background-image: url(${url_for(top_img)})` : ''
|
||||
- var site_title = is_archive() ? _p('page.archives') : page.title || page.tag || page.category || config.title
|
||||
- var isHomeClass = is_home() ? 'full_page' : 'not-index-bg'
|
||||
- is_post() ? isHomeClass = 'post-bg' : isHomeClass
|
||||
|
||||
@@ -11,7 +11,7 @@ mixin articleSort(posts)
|
||||
if article.cover && theme.cover.archives_enable
|
||||
.article-sort-img
|
||||
a.article-sort-item__img(href=url_for(article.path))
|
||||
img(src=`${article.cover}` alt=article.title || 'No Title' onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'`)
|
||||
img(src=url_for(article.cover) alt=article.title || 'No Title' onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'`)
|
||||
.article-sort-post
|
||||
a.article-sort-item__post(href=url_for(article.path))
|
||||
i.fa.fa-clock-o(aria-hidden="true")
|
||||
|
||||
@@ -10,9 +10,9 @@ mixin postUI(posts)
|
||||
.post_cover(class=leftOrRight)
|
||||
a(href=url_for(link) title=title)
|
||||
if theme.lazyload.enable
|
||||
img.post_bg.lazyload(data-src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
|
||||
img.post_bg.lazyload(data-src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
|
||||
else
|
||||
img.post_bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
|
||||
img.post_bg(src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
|
||||
.recent-post-info(class=no_cover)
|
||||
a.article-title(href=url_for(link) title=title)= title
|
||||
.article-meta-wrap
|
||||
|
||||
@@ -18,9 +18,9 @@ else
|
||||
- var pagination_cover = page.prev.cover === false ? page.prev.randomcover : page.prev.cover
|
||||
a(href=url_for(page.prev.path))
|
||||
if theme.lazyload.enable
|
||||
img.prev_cover.lazyload(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` )
|
||||
img.prev_cover.lazyload(data-src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.lodding_bg.post_page)}'` )
|
||||
else
|
||||
img.prev_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` )
|
||||
img.prev_cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.lodding_bg.post_page)}'` )
|
||||
.pagination-info
|
||||
.label=_p('pagination.prev')
|
||||
.prev_info=page.prev.title
|
||||
@@ -31,9 +31,9 @@ else
|
||||
.next-post(class=hasPagePrev)
|
||||
a(href=url_for(page.next.path))
|
||||
if theme.lazyload.enable
|
||||
img.next_cover.lazyload(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
img.next_cover.lazyload(data-src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.lodding_bg.post_page)}'`)
|
||||
else
|
||||
img.next_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
img.next_cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.lodding_bg.post_page)}'`)
|
||||
.pagination-info
|
||||
.label=_p('pagination.next')
|
||||
.next_info=page.next.title
|
||||
@@ -1,4 +1,4 @@
|
||||
if (theme.sharejs && theme.sharejs.enable)
|
||||
.social-share(data-image= page.cover|| theme.avatar.img data-sites= theme.sharejs.sites)
|
||||
.social-share(data-image=url_for(page.cover|| theme.avatar.img) data-sites= theme.sharejs.sites)
|
||||
link(rel="stylesheet" href=url_for(theme.CDN.sharejs_css))
|
||||
script(src=url_for(theme.CDN.sharejs))
|
||||
@@ -16,9 +16,9 @@
|
||||
if post_cover && theme.cover.aside_enable
|
||||
.aside-post-cover
|
||||
if theme.lazyload.enable
|
||||
img.aside-post-bg.lazyload(data-src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` title=title alt=title)
|
||||
img.aside-post-bg.lazyload(data-src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` title=title alt=title)
|
||||
else
|
||||
img.aside-post-bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` title=title alt=title)
|
||||
img.aside-post-bg(src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` title=title alt=title)
|
||||
.aside-post-title(class=no_cover)
|
||||
.aside-post_title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title')
|
||||
time.aside-post_meta.post-meta__date(title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)]
|
||||
|
||||
Reference in New Issue
Block a user