Skip to content

Commit 8e1d30f

Browse files
committed
stater 主題跳轉
1 parent d761d3b commit 8e1d30f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

themes/starter/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,16 @@ const LayoutIndex = (props) => {
110110
* @returns
111111
*/
112112
const LayoutSlug = (props) => {
113-
// 如果 是 /article/[slug] 的文章路径则进行重定向到另一个域名
113+
const { post } = props
114+
115+
// 如果 是 /article/[slug] 的文章路径则視情況进行重定向到另一个域名
114116
const router = useRouter()
115-
if (siteConfig('STARTER_POST_REDIRECT_ENABLE', null, CONFIG) && isBrowser && router.route === '/[prefix]/[slug]') {
117+
if (!post && siteConfig('STARTER_POST_REDIRECT_ENABLE', null, CONFIG) && isBrowser && router.route === '/[prefix]/[slug]') {
116118
const redirectUrl = siteConfig('STARTER_POST_REDIRECT_URL', null, CONFIG) + router.asPath.replace('?theme=landing', '')
117119
router.push(redirectUrl)
118120
return <div id='theme-starter'><Loading /></div>
119121
}
120122

121-
const { post } = props
122123
return <>
123124
<Banner title={post?.title} description={post?.summary}/>
124125
<div className="container grow">

0 commit comments

Comments
 (0)