Skip to content

Commit b91fa33

Browse files
committed
2 parents 67da2b8 + 45009c9 commit b91fa33

File tree

5 files changed

+82
-66
lines changed

5 files changed

+82
-66
lines changed

lib/db/getSiteData.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function compressData(db) {
107107
db.categoryOptions = cleanIds(db?.categoryOptions)
108108
db.customMenu = cleanIds(db?.customMenu)
109109

110-
db.latestPosts = shortenIds(db?.latestPosts)
110+
// db.latestPosts = shortenIds(db?.latestPosts)
111111
db.allNavPages = shortenIds(db?.allNavPages)
112112
// db.allPages = cleanBlocks(db?.allPages)
113113

themes/hexo/components/BlogPostCard.js

+46-30
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,58 @@ import CONFIG from '../config'
55
import { BlogPostCardInfo } from './BlogPostCardInfo'
66

77
const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
8-
const showPreview = siteConfig('HEXO_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap
9-
if (post && !post.pageCoverThumbnail && siteConfig('HEXO_POST_LIST_COVER_DEFAULT', null, CONFIG)) {
8+
const showPreview =
9+
siteConfig('HEXO_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap
10+
if (
11+
post &&
12+
!post.pageCoverThumbnail &&
13+
siteConfig('HEXO_POST_LIST_COVER_DEFAULT', null, CONFIG)
14+
) {
1015
post.pageCoverThumbnail = siteInfo?.pageCover
1116
}
12-
const showPageCover = siteConfig('HEXO_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail && !showPreview
17+
const showPageCover =
18+
siteConfig('HEXO_POST_LIST_COVER', null, CONFIG) &&
19+
post?.pageCoverThumbnail &&
20+
!showPreview
1321
// const delay = (index % 2) * 200
1422

1523
return (
16-
17-
<div className={`${siteConfig('HEXO_POST_LIST_COVER_HOVER_ENLARGE', null, CONFIG) ? ' hover:scale-110 transition-all duration-150' : ''}`} >
18-
<div key={post.id}
19-
data-aos="fade-up"
20-
data-aos-easing="ease-in-out"
21-
data-aos-duration="800"
22-
data-aos-once="false"
23-
data-aos-anchor-placement="top-bottom"
24-
id='blog-post-card'
25-
className={`group md:h-56 w-full flex justify-between md:flex-row flex-col-reverse ${siteConfig('HEXO_POST_LIST_IMG_CROSSOVER', null, CONFIG) && index % 2 === 1 ? 'md:flex-row-reverse' : ''}
24+
<div
25+
className={`${siteConfig('HEXO_POST_LIST_COVER_HOVER_ENLARGE', null, CONFIG) ? ' hover:scale-110 transition-all duration-150' : ''}`}>
26+
<div
27+
key={post.id}
28+
data-aos='fade-up'
29+
data-aos-easing='ease-in-out'
30+
data-aos-duration='800'
31+
data-aos-once='false'
32+
data-aos-anchor-placement='top-bottom'
33+
id='blog-post-card'
34+
className={`group md:h-56 w-full flex justify-between md:flex-row flex-col-reverse ${siteConfig('HEXO_POST_LIST_IMG_CROSSOVER', null, CONFIG) && index % 2 === 1 ? 'md:flex-row-reverse' : ''}
2635
overflow-hidden border dark:border-black rounded-xl bg-white dark:bg-hexo-black-gray`}>
27-
28-
{/* 文字内容 */}
29-
<BlogPostCardInfo index={index} post={post} showPageCover={showPageCover} showPreview={showPreview} showSummary={showSummary} />
30-
31-
{/* 图片封面 */}
32-
{showPageCover && (
33-
<div className="md:w-5/12 overflow-hidden">
34-
<Link href={post?.href} passHref legacyBehavior>
35-
<LazyImage priority={index === 1} src={post?.pageCoverThumbnail} className='h-56 w-full object-cover object-center group-hover:scale-110 duration-500' />
36-
</Link>
37-
</div>
38-
)}
39-
40-
</div>
41-
42-
</div>
43-
36+
{/* 文字内容 */}
37+
<BlogPostCardInfo
38+
index={index}
39+
post={post}
40+
showPageCover={showPageCover}
41+
showPreview={showPreview}
42+
showSummary={showSummary}
43+
/>
44+
45+
{/* 图片封面 */}
46+
{showPageCover && (
47+
<div className='md:w-5/12 overflow-hidden'>
48+
<Link href={post?.href} passHref legacyBehavior>
49+
<LazyImage
50+
priority={index === 1}
51+
alt={post?.title}
52+
src={post?.pageCoverThumbnail}
53+
className='h-56 w-full object-cover object-center group-hover:scale-110 duration-500'
54+
/>
55+
</Link>
56+
</div>
57+
)}
58+
</div>
59+
</div>
4460
)
4561
}
4662

themes/hexo/components/Hero.js

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ const Hero = props => {
9292

9393
<LazyImage
9494
id='header-cover'
95+
alt={siteInfo?.title}
9596
src={siteInfo?.pageCover}
9697
className={`header-cover w-full h-screen object-cover object-center ${siteConfig('HEXO_HOME_NAV_BACKGROUND_IMG_FIXED', null, CONFIG) ? 'fixed' : ''}`}
9798
/>

themes/hexo/components/LatestPostsGroup.js

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const LatestPostsGroup = ({ latestPosts, siteInfo }) => {
4242
className={'my-3 flex'}>
4343
<div className='w-20 h-14 overflow-hidden relative'>
4444
<LazyImage
45+
alt={post?.title}
4546
src={`${headerImage}`}
4647
className='object-cover w-full h-full'
4748
/>

themes/hexo/components/PaginationNumber.js

+33-35
Original file line numberDiff line numberDiff line change
@@ -12,60 +12,58 @@ const PaginationNumber = ({ page, totalPage }) => {
1212
const router = useRouter()
1313
const currentPage = +page
1414
const showNext = page < totalPage
15-
const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
15+
const pagePrefix = router.asPath
16+
.split('?')[0]
17+
.replace(/\/page\/[1-9]\d*/, '')
18+
.replace(/\/$/, '')
1619
const pages = generatePages(pagePrefix, page, currentPage, totalPage)
1720

1821
return (
19-
<div className="mt-10 mb-5 flex justify-center items-end font-medium text-black duration-500 dark:text-gray-300 py-3 space-x-2">
20-
{/* 上一页 */}
21-
<Link
22-
href={{
23-
pathname: currentPage === 2
22+
<div className='mt-10 mb-5 flex justify-center items-end font-medium text-black duration-500 dark:text-gray-300 py-3 space-x-2'>
23+
{/* 上一页 */}
24+
<Link
25+
href={{
26+
pathname:
27+
currentPage === 2
2428
? `${pagePrefix}/`
2529
: `${pagePrefix}/page/${currentPage - 1}`,
26-
query: router.query.s ? { s: router.query.s } : {}
27-
}}
28-
rel="prev"
29-
className={`${currentPage === 1 ? 'invisible' : 'block'} pb-0.5 border-white dark:border-indigo-700 hover:border-indigo-400 dark:hover:border-indigo-400 w-6 text-center cursor-pointer duration-200 hover:font-bold`}>
30+
query: router.query.s ? { s: router.query.s } : {}
31+
}}
32+
rel='prev'
33+
className={`${currentPage === 1 ? 'invisible' : 'block'} pb-0.5 border-white dark:border-indigo-700 hover:border-indigo-400 dark:hover:border-indigo-400 w-6 text-center cursor-pointer duration-200 hover:font-bold`}>
34+
<i className='fas fa-angle-left' />
35+
</Link>
3036

31-
<i className="fas fa-angle-left" />
37+
{pages}
3238

33-
</Link>
34-
35-
{pages}
36-
37-
{/* 下一页 */}
38-
<Link
39-
href={{
40-
pathname: `${pagePrefix}/page/${currentPage + 1}`,
41-
query: router.query.s ? { s: router.query.s } : {}
42-
}}
43-
rel="next"
44-
className={`${+showNext ? 'block' : 'invisible'} pb-0.5 border-b border-indigo-300 dark:border-indigo-700 hover:border-indigo-400 dark:hover:border-indigo-400 w-6 text-center cursor-pointer duration-500 hover:font-bold`}>
45-
46-
<i className="fas fa-angle-right" />
47-
48-
</Link>
39+
{/* 下一页 */}
40+
<Link
41+
href={{
42+
pathname: `${pagePrefix}/page/${currentPage + 1}`,
43+
query: router.query.s ? { s: router.query.s } : {}
44+
}}
45+
rel='next'
46+
className={`${+showNext ? 'block' : 'invisible'} pb-0.5 border-b border-indigo-300 dark:border-indigo-700 hover:border-indigo-400 dark:hover:border-indigo-400 w-6 text-center cursor-pointer duration-500 hover:font-bold`}>
47+
<i className='fas fa-angle-right' />
48+
</Link>
4949
</div>
5050
)
5151
}
5252

5353
function getPageElement(page, currentPage, pagePrefix) {
5454
return (
55-
(<Link
55+
<Link
5656
href={page === 1 ? `${pagePrefix}/` : `${pagePrefix}/page/${page}`}
5757
key={page}
5858
passHref
5959
className={
60-
(page + '' === currentPage + ''
61-
? 'font-bold bg-indigo-400 dark:bg-indigo-500 text-white '
62-
: 'border-b duration-500 border-indigo-300 hover:border-indigo-400 ') +
63-
' border-white dark:border-indigo-700 dark:hover:border-indigo-400 cursor-pointer pb-0.5 w-6 text-center font-light hover:font-bold'
60+
(page + '' === currentPage + ''
61+
? 'font-bold bg-indigo-400 dark:bg-indigo-500 text-white '
62+
: 'border-b duration-500 border-indigo-300 hover:border-indigo-400 ') +
63+
' border-white dark:border-indigo-700 dark:hover:border-indigo-400 cursor-pointer pb-0.5 w-6 text-center font-light hover:font-bold'
6464
}>
65-
6665
{page}
67-
68-
</Link>)
66+
</Link>
6967
)
7068
}
7169

0 commit comments

Comments
 (0)