Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: Svelte 5 is alive
description: Our biggest release yet
author: The Svelte team
authorURL: https://svelte.dev/
pinnedUntil: 2024-11-15
---

After almost 18 months of development, comprising thousands of commits from dozens of contributors, Svelte 5 is finally stable.
Expand Down
14 changes: 12 additions & 2 deletions apps/svelte.dev/src/lib/server/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ function format_date(date: string) {
return `${months[+m - 1]} ${+d} ${y}`;
}

const now = new Date();
const today = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`;

export const blog_posts = index.blog.children
.map((post) => {
const authors: Array<{ name: string; url: string }> = [];
Expand All @@ -45,10 +48,17 @@ export const blog_posts = index.blog.children
...post,
date,
date_formatted: format_date(date),
authors
authors,
pinned: post.metadata.pinnedUntil ? post.metadata.pinnedUntil > today : false
};
})
.sort((a, b) => (a.date < b.date ? 1 : -1));
.sort((a, b) => {
if (!!a.pinned !== !!b.pinned) {
return a.pinned ? -1 : 1;
}

return a.date < b.date ? 1 : -1;
});

/**
* Create docs index, which is basically the same structure as the original index
Expand Down
Loading