mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-13 23:16:47 +00:00
gitbook 标签修改标题
This commit is contained in:
@@ -15,6 +15,7 @@ import { isBrowser } from '@/lib/utils'
|
||||
import { getShortId } from '@/lib/utils/pageId'
|
||||
import { SignIn, SignUp } from '@clerk/nextjs'
|
||||
import dynamic from 'next/dynamic'
|
||||
import Head from 'next/head'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import { createContext, useContext, useEffect, useRef, useState } from 'react'
|
||||
@@ -305,8 +306,16 @@ const LayoutPostList = props => {
|
||||
* @returns
|
||||
*/
|
||||
const LayoutSlug = props => {
|
||||
const { post, prev, next, lock, validPassword } = props
|
||||
const { post, prev, next, siteInfo, lock, validPassword } = props
|
||||
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(() => {
|
||||
// 404
|
||||
if (!post) {
|
||||
@@ -329,6 +338,10 @@ const LayoutSlug = props => {
|
||||
}, [post])
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{title}</title>
|
||||
</Head>
|
||||
|
||||
{/* 文章锁 */}
|
||||
{lock && <ArticleLock validPassword={validPassword} />}
|
||||
|
||||
@@ -574,17 +587,18 @@ const LayoutDashboard = props => {
|
||||
}
|
||||
|
||||
export {
|
||||
Layout404,
|
||||
LayoutArchive,
|
||||
LayoutBase,
|
||||
LayoutCategoryIndex,
|
||||
LayoutDashboard,
|
||||
LayoutIndex,
|
||||
LayoutPostList,
|
||||
LayoutSearch,
|
||||
LayoutSignIn,
|
||||
LayoutSignUp,
|
||||
LayoutSlug,
|
||||
LayoutTagIndex,
|
||||
CONFIG as THEME_CONFIG
|
||||
Layout404,
|
||||
LayoutArchive,
|
||||
LayoutBase,
|
||||
LayoutCategoryIndex,
|
||||
LayoutDashboard,
|
||||
LayoutIndex,
|
||||
LayoutPostList,
|
||||
LayoutSearch,
|
||||
LayoutSignIn,
|
||||
LayoutSignUp,
|
||||
LayoutSlug,
|
||||
LayoutTagIndex,
|
||||
CONFIG as THEME_CONFIG
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user