import Link from 'next/link'
import BLOG from '@/blog.config'
import { formatDateFmt } from '@/lib/formatDate'
import { useRouter } from 'next/router'
/**
* 最新文章列表
* @param posts
* @constructor
*/
const LatestPosts = ({ posts }) => {
// 按时间排序
if (posts) {
posts = posts.sort((a, b) => {
const dateA = new Date(a?.lastEditedTime || a.createdTime)
const dateB = new Date(b?.lastEditedTime || b.createdTime)
return dateB - dateA
}).slice(0, 5)
}
const router = useRouter()
return <>