主页面

修改[you_blog]\themes\butterfly\layout\includes\mixins\post-ui.pug

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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')
const position = theme.cover.position
let leftOrRight = position === 'both'
? index%2 == 0 ? 'left' : 'right'
: position === 'left' ? 'left' : 'right'
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)
+ a(href=url_for(link), target='_blank', title=title)
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
+ a.article-title(href=url_for(link), target='_blank', title=title)= title

侧栏最近更新文章

修改[you_blog]\themes\butterfly\layout\includes\widget\card_recent_post.pug

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
if theme.aside.card_recent_post.enable
.card-widget.card-recent-post
.item-headline
i.fas.fa-history
span= _p('aside.card_recent_post')
.aside-list
- let postLimit = theme.aside.card_recent_post.limit === 0 ? site.posts.length : theme.aside.card_recent_post.limit || 5
- let sort = theme.aside.card_recent_post.sort === 'updated' ? 'updated' : 'date'
- site.posts.sort(sort, -1).limit(postLimit).each(function(article){
- let link = article.link || article.path
- let title = article.title || _p('no_title')
- let no_cover = article.cover === false || !theme.cover.aside_enable ? 'no-cover' : ''
- let post_cover = article.cover
.aside-list-item(class=no_cover)
if post_cover && theme.cover.aside_enable
- a.thumbnail(href=url_for(link) title=title)
+ a.thumbnail(href=url_for(link), target='_blank', title=title)
img(src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title)
.content
- a.title(href=url_for(link) title=title)= title
+ a.title(href=url_for(link), target='_blank', title=title)= title
if theme.aside.card_recent_post.sort === 'updated'
time(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated)) #[=date(article.updated, config.date_format)]
else
time(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)]
- })

归档页面

修改[you_blog]\themes\butterfly\layout\includes\mixins\article-sort.pug

1
2
3
4
5
6
7
8
9
      .article-sort-item(class=no_cover)
if article.cover && theme.cover.archives_enable
- a.article-sort-item-img(href=url_for(article.path) title=title)
+ a.article-sort-item-img(href=url_for(article.path), target='_blank', title=title)
img(src=url_for(article.cover) alt=title onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'`)
.article-sort-item-info
- a.article-sort-item-title(href=url_for(article.path) title=title)= title
+ a.article-sort-item-title(href=url_for(article.path), target='_blank', title=title)= title
span.article-sort-item-index= (current - 1) * config.per_page + post_index + 1
16-使用Algolia搜索 14-分类标签归档页增加文章索引