You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
419 B
13 lines
419 B
export function getAllPosts() {
|
|
const posts = getSlugs()
|
|
.map((slug) => {
|
|
return getFrontMatter(slug);
|
|
})
|
|
.filter((post) => post != null || post != undefined) // Filter post if it is not published
|
|
.sort((a, b) => {
|
|
if (new Date(a.date) > new Date(b.date)) return -1;
|
|
if (new Date(a.date) < new Date(b.date)) return 1;
|
|
return 0;
|
|
});
|
|
return posts;
|
|
} |