diff --git a/components/ThemeSwitch.js b/components/ThemeSwitch.js index d9d8b9b6..756284b2 100644 --- a/components/ThemeSwitch.js +++ b/components/ThemeSwitch.js @@ -15,7 +15,7 @@ export function ThemeSwitch() { return (<> -
+
{/*
{theme}
*/} diff --git a/pages/archive/index.js b/pages/archive/index.js index f60d9f77..700e6273 100644 --- a/pages/archive/index.js +++ b/pages/archive/index.js @@ -25,6 +25,27 @@ export async function getStaticProps() { props.posts = props.allPages.filter(page => page.type === 'Post' && page.status === 'Published') delete props.allPages + const postsSortByDate = Object.create(props.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) + return dateB - dateA + }) + + const archivePosts = {} + + postsSortByDate.forEach(post => { + const date = post.date?.start_date?.slice(0, 7) || post.createdTime + if (archivePosts[date]) { + archivePosts[date].push(post) + } else { + archivePosts[date] = [post] + } + }) + + props.archivePosts = archivePosts + return { props, revalidate: BLOG.NEXT_REVALIDATE_SECOND diff --git a/public/favicon.ico b/public/favicon.ico index b0b448fc..92e7de8f 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/themes/example/LayoutArchive.js b/themes/example/LayoutArchive.js index a89265f3..4ba92d8a 100644 --- a/themes/example/LayoutArchive.js +++ b/themes/example/LayoutArchive.js @@ -3,25 +3,8 @@ import Link from 'next/link' import LayoutBase from './LayoutBase' export const LayoutArchive = props => { - const { posts } = props - const postsSortByDate = Object.create(posts) + const { archivePosts } = 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) - return dateB - dateA - }) - - const archivePosts = {} - - postsSortByDate.forEach(post => { - const date = post.date?.start_date.slice(0, 7) - if (archivePosts[date]) { - archivePosts[date].push(post) - } else { - archivePosts[date] = [post] - } - }) return (
diff --git a/themes/example/components/Nav.js b/themes/example/components/Nav.js index 5bfb8b2d..edb99ac0 100644 --- a/themes/example/components/Nav.js +++ b/themes/example/components/Nav.js @@ -23,7 +23,7 @@ export const Nav = (props) => { return ( - ); + ) } diff --git a/themes/fukasawa/LayoutArchive.js b/themes/fukasawa/LayoutArchive.js index a63f6060..495ed6a4 100644 --- a/themes/fukasawa/LayoutArchive.js +++ b/themes/fukasawa/LayoutArchive.js @@ -3,26 +3,7 @@ import BlogArchiveItem from './components/BlogPostArchive' import LayoutBase from './LayoutBase' export const LayoutArchive = (props) => { - const { posts } = 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) - return dateB - dateA - }) - const archivePosts = {} - - postsSortByDate.forEach(post => { - const date = post.date?.start_date.slice(0, 7) - if (archivePosts[date]) { - archivePosts[date].push(post) - } else { - archivePosts[date] = [post] - } - }) + const { archivePosts } = props useEffect(() => { const anchor = window.location.hash diff --git a/themes/hexo/LayoutArchive.js b/themes/hexo/LayoutArchive.js index 8d2a1c08..dab9d1ce 100644 --- a/themes/hexo/LayoutArchive.js +++ b/themes/hexo/LayoutArchive.js @@ -4,27 +4,7 @@ import Card from './components/Card' import LayoutBase from './LayoutBase' export const LayoutArchive = (props) => { - const { posts } = 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) - return dateB - dateA - }) - - const archivePosts = {} - - postsSortByDate.forEach(post => { - const date = post.date?.start_date.slice(0, 7) - if (archivePosts[date]) { - archivePosts[date].push(post) - } else { - archivePosts[date] = [post] - } - }) + const { archivePosts } = props useEffect(() => { const anchor = window.location.hash diff --git a/themes/hexo/components/BlogPostCard.js b/themes/hexo/components/BlogPostCard.js index dd6cabde..df120154 100644 --- a/themes/hexo/components/BlogPostCard.js +++ b/themes/hexo/components/BlogPostCard.js @@ -103,7 +103,7 @@ const BlogPostCard = ({ post, showSummary }) => { )}
- ); + ) } export default BlogPostCard diff --git a/themes/hexo/components/TopNav.js b/themes/hexo/components/TopNav.js index 6555a27f..3aa310ee 100644 --- a/themes/hexo/components/TopNav.js +++ b/themes/hexo/components/TopNav.js @@ -37,13 +37,13 @@ const TopNav = props => { nav && nav.classList.replace('bg-white', 'bg-none') nav && nav.classList.replace('text-black', 'text-white') nav && nav.classList.replace('border', 'border-transparent') - nav && nav.classList.replace('shadow-md', 'shadow-none') + nav && nav.classList.replace('drop-shadow-md', 'shadow-none') nav && nav.classList.replace('dark:bg-hexo-black-gray', 'transparent') } else { nav && nav.classList.replace('bg-none', 'bg-white') nav && nav.classList.replace('text-white', 'text-black') nav && nav.classList.replace('border-transparent', 'border') - nav && nav.classList.replace('shadow-none', 'shadow-md') + nav && nav.classList.replace('shadow-none', 'drop-shadow-md') nav && nav.classList.replace('transparent', 'dark:bg-hexo-black-gray') } @@ -127,7 +127,7 @@ const TopNav = props => { {/* 导航栏 */} -