mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-08 23:16:54 +00:00
gitbook 标签修改标题
This commit is contained in:
@@ -15,6 +15,7 @@ import { isBrowser } from '@/lib/utils'
|
|||||||
import { getShortId } from '@/lib/utils/pageId'
|
import { getShortId } from '@/lib/utils/pageId'
|
||||||
import { SignIn, SignUp } from '@clerk/nextjs'
|
import { SignIn, SignUp } from '@clerk/nextjs'
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
|
import Head from 'next/head'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { createContext, useContext, useEffect, useRef, useState } from 'react'
|
import { createContext, useContext, useEffect, useRef, useState } from 'react'
|
||||||
@@ -305,8 +306,16 @@ const LayoutPostList = props => {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
const LayoutSlug = props => {
|
const LayoutSlug = props => {
|
||||||
const { post, prev, next, lock, validPassword } = props
|
const { post, prev, next, siteInfo, lock, validPassword } = props
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
// 如果是文档首页文章,则修改浏览器标签
|
||||||
|
const index = siteConfig('GITBOOK_INDEX_PAGE', 'about', CONFIG)
|
||||||
|
const basePath = router.asPath.split('?')[0]
|
||||||
|
const title =
|
||||||
|
basePath?.indexOf(index) > 0
|
||||||
|
? `${post?.title} | ${siteInfo?.description}`
|
||||||
|
: `${post?.title} | ${siteInfo?.title}`
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// 404
|
// 404
|
||||||
if (!post) {
|
if (!post) {
|
||||||
@@ -329,6 +338,10 @@ const LayoutSlug = props => {
|
|||||||
}, [post])
|
}, [post])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<Head>
|
||||||
|
<title>{title}</title>
|
||||||
|
</Head>
|
||||||
|
|
||||||
{/* 文章锁 */}
|
{/* 文章锁 */}
|
||||||
{lock && <ArticleLock validPassword={validPassword} />}
|
{lock && <ArticleLock validPassword={validPassword} />}
|
||||||
|
|
||||||
@@ -574,17 +587,18 @@ const LayoutDashboard = props => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Layout404,
|
Layout404,
|
||||||
LayoutArchive,
|
LayoutArchive,
|
||||||
LayoutBase,
|
LayoutBase,
|
||||||
LayoutCategoryIndex,
|
LayoutCategoryIndex,
|
||||||
LayoutDashboard,
|
LayoutDashboard,
|
||||||
LayoutIndex,
|
LayoutIndex,
|
||||||
LayoutPostList,
|
LayoutPostList,
|
||||||
LayoutSearch,
|
LayoutSearch,
|
||||||
LayoutSignIn,
|
LayoutSignIn,
|
||||||
LayoutSignUp,
|
LayoutSignUp,
|
||||||
LayoutSlug,
|
LayoutSlug,
|
||||||
LayoutTagIndex,
|
LayoutTagIndex,
|
||||||
CONFIG as THEME_CONFIG
|
CONFIG as THEME_CONFIG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ const PostGroupArchive = ({ posts = [], archiveTitle }) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 列表 */}
|
{/* 列表 */}
|
||||||
<ul className='grid grid-cols-1 lg:grid-cols-4 gap-4'>
|
<div className='grid grid-cols-1 lg:grid-cols-4 gap-4'>
|
||||||
{posts?.map((p, index) => {
|
{posts?.map((p, index) => {
|
||||||
return <PostItemCard key={index} post={p} />
|
return <PostItemCard key={index} post={p} />
|
||||||
})}
|
})}
|
||||||
</ul>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ const PostListHorizontal = ({ title, href, posts, hasBg }) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{/* 列表 */}
|
{/* 列表 */}
|
||||||
<ul className='hidden lg:grid grid-cols-1 lg:grid-cols-4 gap-4'>
|
<div className='hidden lg:grid grid-cols-1 lg:grid-cols-4 gap-4'>
|
||||||
{posts?.map((p, index) => {
|
{posts?.map((p, index) => {
|
||||||
return <PostItemCard key={index} post={p} />
|
return <PostItemCard key={index} post={p} />
|
||||||
})}
|
})}
|
||||||
</ul>
|
</div>
|
||||||
<div className='block lg:hidden px-2'>
|
<div className='block lg:hidden px-2'>
|
||||||
<Swiper posts={posts} />
|
<Swiper posts={posts} />
|
||||||
{href && (
|
{href && (
|
||||||
|
|||||||
Reference in New Issue
Block a user