Skip to content

Commit

Permalink
Opti. RSS索引上限修改
Browse files Browse the repository at this point in the history
  • Loading branch information
RavelloH committed Jan 14, 2025
1 parent ec8903d commit 36209db
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/feed.xml/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ export async function GET() {
ttl: '60',
});

const data = await getDB('post');
let data = await getDB('post');

// 倒序排列
data.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));

// 选取最新的 20 篇文章
data = data.slice(0, 20);

data.forEach((post) => {
// console.log(post);
if (!post.published) {
Expand Down

0 comments on commit 36209db

Please sign in to comment.