hexo-theme-butterfly/layout/includes/mixins/UI.pug
Jerry c118e1e16a 🐛 1.修復首頁文章日期顯示錯誤的bug
🐛 2.修復因註釋掉豆瓣設置導致報Cannot read property 'meta' of undefined的bug
💄 3.調整文章頁post-meta和主頁post-meta的間距
💄 4.文章頁,當設置只顯示一個日期時,增加文字顯示
2020-03-19 01:15:45 +08:00

56 lines
3.0 KiB
Plaintext

mixin UI_NEW(posts)
- posts.each(function(article,index){
.recent-post-item
- var link = article.link || article.path
- var post_cover = article.cover
- var title = article.title || _p('no_title')
- var leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius'
- var 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.lazyload(data-src=`${post_cover}` alt=title onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'`)
else
img.post_bg(src=`${post_cover}` alt=title onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'`)
.recent-post-info(class=no_cover)
a.article-title(href=url_for(link) title=title)= title
.article-meta-wrap
if (theme.post_meta.page.date_type)
if (theme.post_meta.page.date_type === 'both')
time.post-meta__date
i.fa.fa-calendar(aria-hidden="true")
=date(article.date, config.date_format)
span.article-meta__separator |
i.fa.fa-history(aria-hidden="true")
=date(article.updated, config.date_format)
else
- var date_type = theme.post_meta.page.date_type === 'updated' ? 'updated' : 'date'
- var date_icon = theme.post_meta.page.date_type === 'updated' ? 'fa-history' :'fa-calendar'
time.post-meta__date
i.fa(class=date_icon aria-hidden="true")
=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 |
each item, index in article.categories.data
i.fa.fa-inbox.article-meta__icon(aria-hidden="true")
a(href=url_for(item.path)).article-meta__categories #[=item.name]
if (index < article.categories.data.length - 1)
i.fa.fa-angle-right(aria-hidden="true")
if (theme.post_meta.page.tags && article.tags.data.length > 0)
span.article-meta.tags
span.article-meta__separator |
each item, index in article.tags.data
i.fa.fa-tag.article-meta__icon(aria-hidden="true")
a(href=url_for(item.path)).article-meta__tags #[=item.name]
if (index < article.tags.data.length - 1)
span.article-meta__link -
if theme.auto_excerpt && theme.auto_excerpt.enable
- const content = strip_html(article.content)
- let expert = content.substring(0, theme.auto_excerpt.length)
- content.length > theme.auto_excerpt.length ? expert += ' ...' : ''
.content!= expert
else
.content!= article.description
- })