简化recent组件

This commit is contained in:
xaoxuu 2022-01-26 18:51:56 +08:00
parent 39153bbcba
commit bd2bc077ab
2 changed files with 23 additions and 15 deletions

View File

@ -27,29 +27,21 @@ function layoutDiv() {
}
el += '<div class="widget-body fs14">';
arr.sort("updated", -1).limit(item.limit).each(function(post) {
el += '<div class="line"></div>'
el += '<a class="more-item" href="' + url_for(post.link || post.path) + '">';
el += '<div class="cap">';
el += '<time>' + date(post.updated, config.date_format) + '</time>';
el += '<div class="more-item">';
el += '<a class="title" href="' + url_for(post.link || post.path) + '">';
if (post.layout == 'wiki') {
el += '<span>';
let proj = theme.wiki.projects[post.wiki];
if (proj && proj.title) {
el += proj.title;
el += proj.title + __('symbol.colon');
} else if (post.wiki) {
el += post.wiki;
el += post.wiki + __('symbol.colon');
}
el += '</span>';
} else {
post.categories.limit(1).forEach((cat, i) => {
el += '<span>' + cat.name + '</span>';
});
}
el += '</div>';
el += '<span class="title">';
el += post.title || post.seo_title || post.wiki;
el += '</span>';
el += '</a>';
el += '</div>';
el += '';
});
el += '</div>';

View File

@ -164,7 +164,9 @@ nav.menu
background: var(--site-bg)
padding-top: 2px
z-index 1
line-height: 2.4
line-height: 2
color: var(--text-p4)
font-size: $fs-14
&:empty
display: none
.cap-action
@ -190,7 +192,21 @@ nav.menu
text-decoration: underline
.widget-header+.widget-body
margin-top: 0
.widget-wrap#recent .widget-body, .widget-wrap#related .widget-body
.widget-wrap .widget-body
.more-item
margin: .5rem 0
.cap
margin-bottom: .25rem
.widget-wrap#recent .widget-body
a
line-height: 1.2
font-weight: 500
color: var(--text-p2)
font-size: $fs-13
&:hover
color: $color-hover
.widget-wrap#related .widget-body
>a
padding 0.5rem
display: block