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 => { >
- {post.date.start_date} + {post.date?.start_date} {' '}   { // 时间排序 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 { diff --git a/themes/fukasawa/components/BlogPostArchive.js b/themes/fukasawa/components/BlogPostArchive.js index 90bc400a..a5f9e286 100644 --- a/themes/fukasawa/components/BlogPostArchive.js +++ b/themes/fukasawa/components/BlogPostArchive.js @@ -27,7 +27,7 @@ const BlogArchiveItem = ({ posts = [], archiveTitle }) => { className="border-l-2 p-1 text-xs md:text-base items-center hover:scale-x-105 hover:border-gray-500 dark:hover:border-gray-300 dark:border-gray-400 transform duration-500" >
- {post.date.start_date}{' '} + {post.date?.start_date}{' '}   diff --git a/themes/hexo/LayoutArchive.js b/themes/hexo/LayoutArchive.js index ed0e97fe..5f30f76e 100644 --- a/themes/hexo/LayoutArchive.js +++ b/themes/hexo/LayoutArchive.js @@ -10,15 +10,15 @@ export const LayoutArchive = (props) => { // 时间排序 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 { diff --git a/themes/hexo/components/BlogPostArchive.js b/themes/hexo/components/BlogPostArchive.js index f7d06014..b7e55b3e 100644 --- a/themes/hexo/components/BlogPostArchive.js +++ b/themes/hexo/components/BlogPostArchive.js @@ -27,7 +27,7 @@ const BlogPostArchive = ({ posts = [], archiveTitle }) => { className="border-l-2 p-1 text-xs md:text-base items-center hover:scale-x-105 hover:border-indigo-500 dark:hover:border-indigo-300 dark:border-indigo-400 transform duration-500" > diff --git a/themes/medium/LayoutArchive.js b/themes/medium/LayoutArchive.js index 9edb9c24..487734ba 100644 --- a/themes/medium/LayoutArchive.js +++ b/themes/medium/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 { @@ -41,7 +41,7 @@ export const LayoutArchive = props => { >
- {post.date.start_date} + {post.date?.start_date} {' '}   { 'flex mt-2 items-center justify-start flex-wrap space-x-3 text-gray-400' } > -
{post.date.start_date}
+
{post.date?.start_date}
{CONFIG_MEDIUM.POST_LIST_CATEGORY && ( )} diff --git a/themes/next/LayoutArchive.js b/themes/next/LayoutArchive.js index 1b322fd0..ce66e25f 100644 --- a/themes/next/LayoutArchive.js +++ b/themes/next/LayoutArchive.js @@ -9,15 +9,15 @@ export const LayoutArchive = (props) => { // 时间排序 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 { diff --git a/themes/next/components/BlogPostArchive.js b/themes/next/components/BlogPostArchive.js index 0ef8ee86..d2d6f857 100644 --- a/themes/next/components/BlogPostArchive.js +++ b/themes/next/components/BlogPostArchive.js @@ -27,7 +27,7 @@ const BlogPostArchive = ({ posts = [], archiveTitle }) => { className="border-l-2 p-1 text-xs md:text-base items-center hover:scale-x-105 hover:border-gray-500 dark:hover:border-gray-300 dark:border-gray-400 transform duration-500" >