Skip to content

Commit d761d3b

Browse files
committed
redirect
1 parent 5b52bc2 commit d761d3b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

themes/starter/config.js

+2
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ const CONFIG = {
297297
STARTER_404_TEXT: '抱歉!您要查找的页面不存在。可能已经移动或删除。',
298298
STARTER_404_BACK: '回到主页',
299299

300+
STARTER_POST_REDIRECT_ENABLE: true, // 默認開啟重定向
301+
STARTER_POST_REDIRECT_URL: 'https://blog.tangly1024.com', // 重定向域名
300302
STARTER_NEWSLETTER: process.env.NEXT_PUBLIC_THEME_STARTER_NEWSLETTER || false // 是否开启邮件订阅 请先配置mailchimp功能 https://docs.tangly1024.com/article/notion-next-mailchimp
301303
}
302304
export default CONFIG

themes/starter/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ const LayoutIndex = (props) => {
112112
const LayoutSlug = (props) => {
113113
// 如果 是 /article/[slug] 的文章路径则进行重定向到另一个域名
114114
const router = useRouter()
115-
if (siteConfig('LANDING_POST_REDIRECT_ENABLE', null, CONFIG) && isBrowser && router.route === '/[prefix]/[slug]') {
116-
const redirectUrl = siteConfig('LANDING_POST_REDIRECT_URL', null, CONFIG) + router.asPath.replace('?theme=landing', '')
115+
if (siteConfig('STARTER_POST_REDIRECT_ENABLE', null, CONFIG) && isBrowser && router.route === '/[prefix]/[slug]') {
116+
const redirectUrl = siteConfig('STARTER_POST_REDIRECT_URL', null, CONFIG) + router.asPath.replace('?theme=landing', '')
117117
router.push(redirectUrl)
118-
return <div id='theme-landing'><Loading /></div>
118+
return <div id='theme-starter'><Loading /></div>
119119
}
120120

121121
const { post } = props

0 commit comments

Comments
 (0)