This commit is contained in:
tangly1024.com
2023-11-06 16:28:01 +08:00
parent ecf7825dad
commit a0b481eaca
137 changed files with 326 additions and 383 deletions

View File

@@ -1,4 +1,3 @@
import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import { useRouter } from 'next/router'
@@ -8,7 +7,7 @@ import { siteConfig } from '@/lib/config'
export default function ArticleCopyright () {
const router = useRouter()
const [path, setPath] = useState(BLOG.LINK + router.asPath)
const [path, setPath] = useState(siteConfig('LINK') + router.asPath)
useEffect(() => {
setPath(window.location.href)
})

View File

@@ -1,6 +1,6 @@
import Link from 'next/link'
import CONFIG from '../config'
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import LazyImage from '@/components/LazyImage'
@@ -38,7 +38,7 @@ export default function ArticleRecommend({ recommendPosts, siteInfo }) {
(<Link
key={post.id}
title={post.title}
href={`${BLOG.SUB_PATH}/${post.slug}`}
href={`${siteConfig('SUB_PATH')}/${post.slug}`}
passHref
className="flex h-40 cursor-pointer overflow-hidden">

View File

@@ -1,5 +1,6 @@
import Link from 'next/link'
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
/**
* 博客归档列表
* @param posts 所有文章
@@ -29,7 +30,7 @@ const BlogPostArchive = ({ posts = [], archiveTitle }) => {
<span className="text-gray-400">{post.date?.start_date}</span>{' '}
&nbsp;
<Link
href={`${BLOG.SUB_PATH}/${post.slug}`}
href={`${siteConfig('SUB_PATH')}/${post.slug}`}
passHref
className="dark:text-gray-400 dark:hover:text-red-300 overflow-x-hidden hover:underline cursor-pointer text-gray-600">

View File

@@ -2,7 +2,7 @@ import NotionPage from '@/components/NotionPage'
import Link from 'next/link'
import TagItemMini from './TagItemMini'
import TwikooCommentCount from '@/components/TwikooCommentCount'
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import { formatDateFmt } from '@/lib/formatDate'
/**
@@ -15,7 +15,7 @@ export const BlogPostCardInfo = ({ post, showPreview, showPageCover, showSummary
<div>
{/* 标题 */}
<Link
href={`${BLOG.SUB_PATH}/${post.slug}`}
href={`${siteConfig('SUB_PATH')}/${post.slug}`}
passHref
className={`line-clamp-2 replace cursor-pointer text-2xl ${showPreview ? 'text-center' : ''
} leading-tight font-normal text-gray-600 dark:text-gray-100 hover:text-red-700 dark:hover:text-red-400`}>

View File

@@ -1,6 +1,6 @@
import ProductCard from './ProductCard'
import PaginationNumber from './PaginationNumber'
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import BlogPostListEmpty from './BlogPostListEmpty'
/**
@@ -12,8 +12,8 @@ import BlogPostListEmpty from './BlogPostListEmpty'
* @constructor
*/
const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => {
const totalPage = Math.ceil(postCount / BLOG.POSTS_PER_PAGE)
const showPagination = postCount >= BLOG.POSTS_PER_PAGE
const totalPage = Math.ceil(postCount / parseInt(siteConfig('POSTS_PER_PAGE')))
const showPagination = postCount >= parseInt(siteConfig('POSTS_PER_PAGE'))
if (!posts || posts.length === 0 || page > totalPage) {
return <BlogPostListEmpty />
} else {

View File

@@ -1,4 +1,4 @@
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import ProductCard from './ProductCard'
import BlogPostListEmpty from './BlogPostListEmpty'
import { useGlobal } from '@/lib/global'
@@ -14,7 +14,7 @@ import { useEffect, useRef, useState } from 'react'
* @constructor
*/
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG.POST_LIST_SUMMARY, siteInfo }) => {
const postsPerPage = BLOG.POSTS_PER_PAGE
const postsPerPage = parseInt(siteConfig('POSTS_PER_PAGE'))
const [page, updatePage] = useState(1)
const postsToShow = getListByPage(posts, page, postsPerPage)

View File

@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react'
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import Card from '@/themes/hexo/components/Card'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
@@ -16,7 +16,7 @@ const HexoRecentComments = (props) => {
const [onLoading, changeLoading] = useState(true)
useEffect(() => {
RecentComments({
serverURL: BLOG.COMMENT_WALINE_SERVER_URL,
serverURL: siteConfig('COMMENT_WALINE_SERVER_URL'),
count: 5
}).then(({ comments }) => {
changeLoading(false)

View File

@@ -1,4 +1,4 @@
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import LazyImage from '@/components/LazyImage'
import { useGlobal } from '@/lib/global'
// import Image from 'next/image'
@@ -28,7 +28,7 @@ const LatestPostsGroup = ({ latestPosts, siteInfo }) => {
</div>
</div>
{latestPosts.map(post => {
const selected = currentPath === `${BLOG.SUB_PATH}/${post.slug}`
const selected = currentPath === `${siteConfig('SUB_PATH')}/${post.slug}`
const headerImage = post?.pageCoverThumbnail ? post.pageCoverThumbnail : siteInfo?.pageCover
@@ -36,7 +36,7 @@ const LatestPostsGroup = ({ latestPosts, siteInfo }) => {
(<Link
key={post.id}
title={post.title}
href={`${BLOG.SUB_PATH}/${post.slug}`}
href={`${siteConfig('SUB_PATH')}/${post.slug}`}
passHref
className={'my-3 flex'}>

View File

@@ -1,6 +1,6 @@
import Link from 'next/link'
import CONFIG from '../config'
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import LazyImage from '@/components/LazyImage'
// import Image from 'next/image'
@@ -19,7 +19,7 @@ const ProductCard = ({ index, post, siteInfo }) => {
<div key={post.id} className={'group flex flex-col space-y-2 justify-between border dark:border-black bg-white dark:bg-hexo-black-gray'}>
{/* 图片封面 */}
<Link href={`${BLOG.SUB_PATH}/${post.slug}`} passHref legacyBehavior>
<Link href={`${siteConfig('SUB_PATH')}/${post.slug}`} passHref legacyBehavior>
<div className="overflow-hidden m-2">
<LazyImage priority={index === 1} src={post?.pageCoverThumbnail} className='h-auto aspect-square w-full object-cover object-center group-hover:scale-110 duration-500' />
</div>

View File

@@ -6,7 +6,7 @@ import Catalog from './Catalog'
import { InfoCard } from './InfoCard'
import { AnalyticsCard } from './AnalyticsCard'
import CONFIG from '../config'
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import dynamic from 'next/dynamic'
import Announcement from './Announcement'
import { useGlobal } from '@/lib/global'
@@ -65,7 +65,7 @@ export default function SideRight(props) {
<Announcement post={notice}/>
{BLOG.COMMENT_WALINE_SERVER_URL && BLOG.COMMENT_WALINE_RECENT && <HexoRecentComments/>}
{siteConfig('COMMENT_WALINE_SERVER_URL') && siteConfig('COMMENT_WALINE_RECENT') && <HexoRecentComments/>}
<div className='sticky top-20'>
{post && post.toc && post.toc.length > 1 && <Card>