mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-17 04:40:53 +08:00
feat: 點擊文字特效增加隨機配置 feat: 可配置是否添加css前綴 fix: 修復子目錄下,配置justifiedGallery CDN(相對鏈接)後,連接會無法訪問的bugs fix: 修復 pangu 配置post 後,仍在全站生效的bugs improvement: 夜間模式下,廣告降低亮度 improvement: 手機端toc邊距微調 improvement: html格式優化 improvement: 搜索優化 improvement: 刪除不必要的語言文件
82 lines
4.4 KiB
Plaintext
82 lines
4.4 KiB
Plaintext
mixin postUI(posts)
|
|
each article , index in page.posts.data
|
|
.recent-post-item
|
|
- let link = article.link || article.path
|
|
- let title = article.title || _p('no_title')
|
|
- let leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius'
|
|
- let post_cover = article.cover
|
|
- let no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : ''
|
|
if post_cover && theme.cover.index_enable
|
|
.post_cover(class=leftOrRight)
|
|
a(href=url_for(link) title=title)
|
|
if theme.lazyload.enable
|
|
img.post_bg(data-lazy-src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.error_img.post_page) + `'` alt=title)
|
|
else
|
|
img.post_bg(src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.error_img.post_page) + `'` alt=title)
|
|
.recent-post-info(class=no_cover)
|
|
a.article-title(href=url_for(link) title=title)= title
|
|
.article-meta-wrap
|
|
if (is_home() && (article.top || article.sticky > 0))
|
|
span.article-meta
|
|
i.fas.fa-thumbtack.article-meta__icon.sticky
|
|
span.sticky= _p('sticky')
|
|
span.article-meta__separator |
|
|
if (theme.post_meta.page.date_type)
|
|
span.post-meta-date
|
|
if (theme.post_meta.page.date_type === 'both')
|
|
i.far.fa-calendar-alt
|
|
span.article-meta-label=_p('post.created')
|
|
time.post-meta-date-created(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date))=date(article.date, config.date_format)
|
|
span.article-meta__separator |
|
|
i.fas.fa-history
|
|
span.article-meta-label=_p('post.updated')
|
|
time.post-meta-date-updated(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated))=date(article.updated, config.date_format)
|
|
else
|
|
- let data_type_updated = theme.post_meta.page.date_type === 'updated'
|
|
- let date_type = data_type_updated ? 'updated' : 'date'
|
|
- let date_icon = data_type_updated ? 'fas fa-history' :'far fa-calendar-alt'
|
|
- let date_title = data_type_updated ? _p('post.updated') : _p('post.created')
|
|
i(class=date_icon)
|
|
span.article-meta-label=date_title
|
|
time(datetime=date_xml(article[date_type]) title=date_title + ' ' + full_date(article[date_type]))=date(article[date_type], config.date_format)
|
|
if (theme.post_meta.page.categories && article.categories.data.length > 0)
|
|
span.article-meta
|
|
span.article-meta__separator |
|
|
i.fas.fa-inbox.article-meta__icon
|
|
each item, index in article.categories.data
|
|
a(href=url_for(item.path)).article-meta__categories #[=item.name]
|
|
if (index < article.categories.data.length - 1)
|
|
i.fas.fa-angle-right
|
|
if (theme.post_meta.page.tags && article.tags.data.length > 0)
|
|
span.article-meta.tags
|
|
span.article-meta__separator |
|
|
i.fas.fa-tag.article-meta__icon
|
|
each item, index in article.tags.data
|
|
a(href=url_for(item.path)).article-meta__tags #[=item.name]
|
|
if (index < article.tags.data.length - 1)
|
|
span.article-meta__link #[='•']
|
|
|
|
//- Display the article introduction on homepage
|
|
case theme.index_post_content.method
|
|
when false
|
|
- break
|
|
when 1
|
|
.content!= article.description
|
|
when 2
|
|
if article.description
|
|
.content!= article.description
|
|
else
|
|
- const content = strip_html(article.content)
|
|
- let expert = content.substring(0, theme.index_post_content.length)
|
|
- content.length > theme.index_post_content.length ? expert += ' ...' : ''
|
|
.content!= expert
|
|
default
|
|
- const content = strip_html(article.content)
|
|
- let expert = content.substring(0, theme.index_post_content.length)
|
|
- content.length > theme.index_post_content.length ? expert += ' ...' : ''
|
|
.content!= expert
|
|
|
|
if theme.ad && theme.ad.index
|
|
if (index + 1) % 3 == 0
|
|
.recent-post-item.ads-wrap!=theme.ad.index
|