Merge branch 'tangly1024:main' into pikachu-NotionNext

This commit is contained in:
liboq
2023-08-14 14:36:24 +08:00
committed by GitHub
3 changed files with 30 additions and 8 deletions

View File

@@ -129,7 +129,7 @@ const LayoutPostList = props => {
slotTop = <div className='pb-12'><i className="mr-1 fas fa-folder-open" />{category}</div>
} else if (tag) {
slotTop = <div className='pb-12'>#{tag}</div>
}else if(props.slotTop){
} else if (props.slotTop) {
slotTop = props.slotTop
}
return (

View File

@@ -57,6 +57,9 @@ const CONFIG = {
TESTIMONIALS_SOCIAL_URL: 'https://blog.gaoran.xyz/',
TESTIMONIALS_WORD: '“ 感谢大佬的方法。之前尝试过Super、Potion等国外的第三方平台实现效果一般个性化程度远不如这个方法已经用起来了 “',
POST_REDIRECT_ENABLE: process.env.NEXT_PUBLIC_POST_REDIRECT_ENABLE || false, // 是否开启文章地址重定向 用于迁移旧网站域名
POST_REDIRECT_URL: process.env.NEXT_PUBLIC_POST_REDIRECT_URL || 'https://blog.tangly1024.com', // 重定向网站地址
NEWSLETTER: process.env.NEXT_PUBLIC_THEME_LANDING_NEWSLETTER || false // 是否开启邮件订阅 请先配置mailchimp功能 https://docs.tangly1024.com/article/notion-next-mailchimp
}
export default CONFIG

View File

@@ -1,4 +1,6 @@
'use client'
/**
* 这是一个空白主题,方便您用作创建新主题时的模板,从而开发出您自己喜欢的主题
* 1. 禁用了代码质量检查功能提高了代码的宽容度您可以使用标准的html写法
@@ -15,6 +17,10 @@ import FeaturesBlocks from './components/FeaturesBlocks'
import Testimonials from './components/Testimonials'
import Newsletter from './components/Newsletter'
import CommonHead from '@/components/CommonHead'
import { useRouter } from 'next/router'
import CONFIG from './config'
import Loading from '@/components/Loading'
import { isBrowser } from '@/lib/utils'
/**
* 这是个配置文件,可以方便在此统一配置信息
@@ -31,8 +37,8 @@ const THEME_CONFIG = { THEME: 'landing' }
const LayoutBase = (props) => {
const { meta, siteInfo, children } = props
return <div id='theme-blank' className="overflow-hidden flex flex-col justify-between bg-white">
return <div id='theme-landing' className="overflow-hidden flex flex-col justify-between bg-white">
{/* 网页SEO */}
<CommonHead meta={meta} siteInfo={siteInfo} />
@@ -72,11 +78,24 @@ const LayoutIndex = (props) => {
* @param {*} props
* @returns
*/
const LayoutSlug = (props) => <LayoutBase {...props}>
<div id='container-inner' className='mx-auto max-w-screen-lg p-12'>
<NotionPage {...props} />
</div>
</LayoutBase>
const LayoutSlug = (props) => {
// 如果 是 /article/[slug] 的文章路径则进行重定向到另一个域名
const router = useRouter()
if (JSON.parse(CONFIG.POST_REDIRECT_ENABLE) && isBrowser && router.route == '/[prefix]/[slug]') {
const redirectUrl = CONFIG.POST_REDIRECT_URL + router.asPath.replace('?theme=landing', '')
router.push(redirectUrl)
return <div id='theme-landing'><Loading /></div>
}
return <LayoutBase {...props}>
<div id='container-inner' className='mx-auto max-w-screen-lg p-12'>
<NotionPage {...props} />
</div>
</LayoutBase>
}
// 其他布局暂时留空
const LayoutSearch = (props) => <LayoutBase {...props}><Hero /></LayoutBase>