diff --git a/src/composables/useContent.ts b/src/composables/useContent.ts index 3ae68cb..17f2d7c 100644 --- a/src/composables/useContent.ts +++ b/src/composables/useContent.ts @@ -42,22 +42,19 @@ export function useSkills() { } export function usePosts() { - return useAsyncData('content:posts', () => { - return queryContent('writing') - .sort({ - publishedAt: -1, - }) - .find() + return useAsyncData('content:posts', async () => { + const posts = await queryContent('writing').find() + return posts.sort((a, b) => { + return new Date(b.publishedAt).getTime() - new Date(a.publishedAt).getTime() + }) }) } export function useLatestPost() { - return useAsyncData('content:latestPost', () => { - return queryContent('writing') - .sort({ - publishedAt: -1, - }) - .limit(1) - .find() + return useAsyncData('content:latestPost', async () => { + const posts = await queryContent('writing').find() + return posts.sort((a, b) => { + return new Date(b.publishedAt).getTime() - new Date(a.publishedAt).getTime() + })[0] }) } diff --git a/src/content/writing/how-i-start.md b/src/content/writing/how-i-start.md index c0dffa1..e2dc66b 100644 --- a/src/content/writing/how-i-start.md +++ b/src/content/writing/how-i-start.md @@ -2,7 +2,7 @@ slug: how-i-start title: 'How do I start programming?' description: 'Description de test' -publishedAt: '04 September 2023' +publishedAt: '01/02/2023' readingMins: 5 --- diff --git a/src/content/writing/new-website.md b/src/content/writing/new-website.md index 3074745..3de7b36 100644 --- a/src/content/writing/new-website.md +++ b/src/content/writing/new-website.md @@ -2,7 +2,7 @@ slug: 'new-website' title: 'New version for my portfolio' description: 'Description de test' -publishedAt: '04 September 2023' +publishedAt: '09/09/2021' readingMins: 5 ---