29 lines
568 B
Plaintext
29 lines
568 B
Plaintext
---
|
|
import Post from "../components/Post.astro";
|
|
|
|
const { allPosts } = Astro.props;
|
|
|
|
//.sort(() => 0.5 - Math.random()).slice(0, 3);
|
|
|
|
let posts = allPosts
|
|
.sort(
|
|
(a, b) =>
|
|
new Date(b.frontmatter.updated || b.frontmatter.added).valueOf() -
|
|
new Date(a.frontmatter.updated || a.frontmatter.added).valueOf()
|
|
)
|
|
.slice(0, 5);
|
|
---
|
|
|
|
<content>
|
|
<ul class="posts-list">
|
|
{
|
|
posts.map(
|
|
({
|
|
url,
|
|
frontmatter: { description, slug, title, tags, added: date },
|
|
}) => <Post {url} {description} {date} {slug} {title} {tags} />
|
|
)
|
|
}
|
|
</ul>
|
|
</content>
|