diff --git a/components/blog-archive.vue b/components/blog-archive.vue index a6a8719..803b1da 100644 --- a/components/blog-archive.vue +++ b/components/blog-archive.vue @@ -28,7 +28,7 @@ interface Archive { posts: BlogPost[]; } -const props = defineProps<{ posts: BlogPost[] }>(); +const props = defineProps<{ posts: BlogPost[] | null }>(); const monthNames = [ 'Jan', @@ -49,7 +49,7 @@ const yearGroup = computed(() => { const groups: Archive[] = []; props.posts - .sort((a, b) => + ?.sort((a, b) => new Date(b.date) .toISOString() .localeCompare(new Date(a.date).toISOString(), 'en', { numeric: true }) diff --git a/components/blog-post.vue b/components/blog-post.vue index ee33f03..62ae4cc 100644 --- a/components/blog-post.vue +++ b/components/blog-post.vue @@ -1,5 +1,5 @@