修复404跳转bug

This commit is contained in:
tangly1024
2022-04-13 13:05:20 +08:00
parent b122bab41d
commit f1a29575bd
14 changed files with 78 additions and 37 deletions

View File

@@ -24,19 +24,18 @@ const Slug = props => {
const article = document.getElementById('container')
if (!article) {
router.push('/404').then(() => {
console.log('找不到页面', router.asPath)
console.warn('找不到页面', router.asPath)
})
}
}
}, 3000)
})
return <p>Redirecting...</p>
const meta = { title: `${props?.siteInfo?.title} | loading` }
return <ThemeComponents.LayoutSlug {...props} showArticleInfo={true} meta={meta} />
}
// 文章锁🔐
const [lock, setLock] = useState(post.password && post.password !== '')
console.log('lock 默认值', lock)
useEffect(() => {
if (post.password && post.password !== '') {
setLock(true)

View File

@@ -7,9 +7,8 @@ const Index = props => {
const { keyword, siteInfo } = props
const { locale } = useGlobal()
const meta = {
title: `${keyword || ''}${keyword ? ' | ' : ''}${locale.NAV.SEARCH} | ${
siteInfo.title
}`,
title: `${keyword || ''}${keyword ? ' | ' : ''}${locale.NAV.SEARCH} | ${siteInfo.title
}`,
description: siteInfo.title,
slug: 'search/' + (keyword || ''),
type: 'website'
@@ -111,7 +110,7 @@ async function filterByMemCache(allPosts, keyword) {
indexContent = appendText(indexContent, properties, 'caption')
})
}
// console.log('搜索是否命中缓存', page !== null, indexContent)
console.log('搜索是否命中缓存', page !== null, indexContent)
post.results = []
let hitCount = 0
for (const i in indexContent) {