diff --git a/themes/example/LayoutArchive.js b/themes/example/LayoutArchive.js index 1b3d1e34..a8bc68ee 100644 --- a/themes/example/LayoutArchive.js +++ b/themes/example/LayoutArchive.js @@ -7,15 +7,15 @@ export const LayoutArchive = props => { const postsSortByDate = Object.create(posts) postsSortByDate.sort((a, b) => { - const dateA = new Date(a?.date.start_date || a.createdTime) - const dateB = new Date(b?.date.start_date || b.createdTime) + const dateA = new Date(a?.date?.start_date || a.createdTime) + const dateB = new Date(b?.date?.start_date || b.createdTime) return dateB - dateA }) const archivePosts = {} postsSortByDate.forEach(post => { - const date = post.date.start_date.slice(0, 7) + const date = post.date?.start_date.slice(0, 7) if (archivePosts[date]) { archivePosts[date].push(post) } else { @@ -39,7 +39,7 @@ export const LayoutArchive = props => { >