[fix] recent sort

This commit is contained in:
xaoxuu 2022-11-19 23:14:41 +08:00
parent 977d3264b8
commit 7e2fa31b62
2 changed files with 3 additions and 1 deletions

View File

@ -20,11 +20,12 @@ function layoutDiv() {
}
return false
})
arr = arr.sort((p1, p2) => p1.updated > p2.updated ? -1 : 1)
} else {
arr = site.posts.filter( p => p.title && p.title.length > 0)
arr = arr.sort("updated", -1)
}
el += '<div class="widget-body related-posts fs14">';
arr = arr.sort((p1, p2) => p1.order > p2.order ? -1 : 1)
arr.length = item.limit
arr.forEach(post => {
el += '<a class="item title" href="' + url_for(post.link || post.path) + '">';

View File

@ -13,6 +13,7 @@ class WikiPage {
this.seo_title = page.seo_title
this.wiki = page.wiki
this.order = page.order || 0
this.updated = page.updated
}
}