mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 15:09:22 +00:00
Merge branch 'main' of https://github.com/tangly1024/NotionNext into main
This commit is contained in:
@@ -20,18 +20,32 @@ const Artalk = ({ siteInfo }) => {
|
||||
|
||||
const initArtalk = async () => {
|
||||
await loadExternalResource(artalkCss, 'css')
|
||||
window?.Artalk?.init({
|
||||
server: artalkServer, // 后端地址
|
||||
el: '#artalk', // 容器元素
|
||||
const artalk = window?.Artalk?.init({
|
||||
server: artalkServer,
|
||||
el: '#artalk',
|
||||
locale: artalkLocale,
|
||||
// pageKey: '/post/1', // 固定链接 (留空自动获取)
|
||||
// pageTitle: '关于引入 Artalk 的这档子事', // 页面标题 (留空自动获取)
|
||||
site: site // 你的站点名
|
||||
site: site,
|
||||
darkMode: document.documentElement.classList.contains('dark')
|
||||
})
|
||||
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
if (mutation.attributeName === 'class') {
|
||||
const isDark = document.documentElement.classList.contains('dark')
|
||||
artalk?.setDarkMode(isDark)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
observer.observe(document.documentElement, {
|
||||
attributes: true,
|
||||
attributeFilter: ['class']
|
||||
})
|
||||
|
||||
return () => observer.disconnect()
|
||||
}
|
||||
return (
|
||||
<div id="artalk"></div>
|
||||
)
|
||||
|
||||
return <div id="artalk"></div>
|
||||
}
|
||||
|
||||
export default Artalk
|
||||
|
||||
@@ -157,18 +157,24 @@ export async function getConfigMapFromConfigPage(allPages) {
|
||||
// 只导入生效的配置
|
||||
if (config.enable) {
|
||||
// console.log('[Notion配置]', config.key, config.value)
|
||||
notionConfig[config.key] = config.value || null
|
||||
notionConfig[config.key] =
|
||||
parseTextToJson(config.value) || config.value || null
|
||||
// 配置不能是undefined,至少是null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 最后检查Notion_Config页面的INLINE_CONFIG,是否是一个js对象
|
||||
const combine = Object.assign(
|
||||
{},
|
||||
deepClone(notionConfig),
|
||||
parseConfig(notionConfig?.INLINE_CONFIG)
|
||||
)
|
||||
let combine = notionConfig
|
||||
try {
|
||||
// 将INLINE_CONFIG合并,@see https://docs.tangly1024.com/article/notion-next-inline-config
|
||||
combine = Object.assign(
|
||||
{},
|
||||
deepClone(notionConfig),
|
||||
notionConfig?.INLINE_CONFIG
|
||||
)
|
||||
} catch (err) {
|
||||
console.warn('解析 INLINE_CONFIG 配置时出错,请检查JSON格式', err)
|
||||
}
|
||||
return combine
|
||||
}
|
||||
|
||||
@@ -187,7 +193,23 @@ export function parseConfig(configString) {
|
||||
const config = eval('(' + configString + ')')
|
||||
return config
|
||||
} catch (evalError) {
|
||||
console.error('解析 eval(INLINE_CONFIG) 配置时出错:', evalError)
|
||||
console.warn(
|
||||
'解析 eval(INLINE_CONFIG) 配置时出错,请检查JSON格式',
|
||||
evalError
|
||||
)
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析文本为JSON
|
||||
* @param text
|
||||
* @returns {any|null}
|
||||
*/
|
||||
export function parseTextToJson(text) {
|
||||
try {
|
||||
return JSON.parse(text)
|
||||
} catch (error) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,31 +11,35 @@ export function AnalyticsCard(props) {
|
||||
const today = new Date()
|
||||
const diffTime = today.getTime() - targetDate.getTime() // 获取两个日期之间的毫秒数差值
|
||||
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) // 将毫秒数差值转换为天数差值
|
||||
const postCountTitle = siteConfig('HEO_POST_COUNT_TITLE', null, CONFIG)
|
||||
const siteTimeTitle = siteConfig('HEO_SITE_TIME_TITLE', null, CONFIG)
|
||||
const siteVisitTitle = siteConfig('HEO_SITE_VISIT_TITLE', null, CONFIG)
|
||||
const siteVisitorTitle = siteConfig('HEO_SITE_VISITOR_TITLE', null, CONFIG)
|
||||
|
||||
const { postCount } = props
|
||||
return <>
|
||||
<div className='text-md flex flex-col space-y-1 justify-center px-3'>
|
||||
<div className='inline'>
|
||||
<div className='flex justify-between'>
|
||||
<div>文章数:</div>
|
||||
<div>{postCountTitle}</div>
|
||||
<div>{postCount}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className='inline'>
|
||||
<div className='flex justify-between'>
|
||||
<div>建站天数:</div>
|
||||
<div>{siteTimeTitle}</div>
|
||||
<div>{diffDays} 天</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className='hidden busuanzi_container_page_pv'>
|
||||
<div className='flex justify-between'>
|
||||
<div>访问量:</div>
|
||||
<div>{siteVisitTitle}</div>
|
||||
<div className='busuanzi_value_page_pv' />
|
||||
</div>
|
||||
</div>
|
||||
<div className='hidden busuanzi_container_site_uv'>
|
||||
<div className='flex justify-between'>
|
||||
<div>访客数:</div>
|
||||
<div>{siteVisitorTitle}</div>
|
||||
<div className='busuanzi_value_site_uv' />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -122,6 +122,12 @@ const CONFIG = {
|
||||
HEO_SOCIAL_CARD_TITLE_3: '点击加入社群',
|
||||
HEO_SOCIAL_CARD_URL: 'https://docs.tangly1024.com/article/how-to-question',
|
||||
|
||||
// 底部统计面板文案
|
||||
HEO_POST_COUNT_TITLE: '文章数:',
|
||||
HEO_SITE_TIME_TITLE: '建站天数:',
|
||||
HEO_SITE_VISIT_TITLE: '访问量:',
|
||||
HEO_SITE_VISITOR_TITLE: '访客数:',
|
||||
|
||||
// ***** 以下配置无效,只是预留开发 ****
|
||||
// 菜单配置
|
||||
HEO_MENU_INDEX: true, // 显示首页
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable @next/next/no-img-element */
|
||||
/* eslint-disable react/no-unescaped-entities */
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import Link from 'next/link'
|
||||
|
||||
/**
|
||||
* 首页的关于模块
|
||||
@@ -27,11 +28,11 @@ export const About = () => {
|
||||
__html: siteConfig('STARTER_ABOUT_TEXT')
|
||||
}}></p>
|
||||
|
||||
<a
|
||||
href={siteConfig('STARTER_ABOUT_BUTTON_URL')}
|
||||
<Link
|
||||
href={siteConfig('STARTER_ABOUT_BUTTON_URL', '')}
|
||||
className='inline-flex items-center justify-center rounded-md border border-primary bg-primary px-7 py-3 text-center text-base font-medium text-white hover:border-blue-dark hover:bg-blue-dark'>
|
||||
{siteConfig('STARTER_ABOUT_BUTTON_TEXT')}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import Link from 'next/link'
|
||||
|
||||
/**
|
||||
* CTA,用于创建一个呼吁用户行动的部分(Call To Action,简称 CTA)。
|
||||
@@ -29,11 +30,11 @@ export const CTA = () => {
|
||||
</p>
|
||||
{siteConfig('STARTER_CTA_BUTTON') && (
|
||||
<>
|
||||
<a
|
||||
href={siteConfig('STARTER_CTA_BUTTON_URL')}
|
||||
<Link
|
||||
href={siteConfig('STARTER_CTA_BUTTON_URL', '')}
|
||||
className='inline-block rounded-md border border-transparent bg-secondary px-7 py-3 text-base font-medium text-white transition hover:bg-[#0BB489]'>
|
||||
{siteConfig('STARTER_CTA_BUTTON_TEXT')}
|
||||
</a>
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { SVGDesign } from './svg/SVGDesign'
|
||||
import { SVGEssential } from './svg/SVGEssential'
|
||||
import { SVGGifts } from './svg/SVGGifts'
|
||||
import { SVGTemplate } from './svg/SVGTemplate'
|
||||
import Link from 'next/link'
|
||||
/**
|
||||
* 产品特性相关,将显示在首页中
|
||||
* @returns
|
||||
@@ -41,11 +42,11 @@ export const Features = () => {
|
||||
<p className='mb-8 text-body-color dark:text-dark-6 lg:mb-9'>
|
||||
{siteConfig('STARTER_FEATURE_1_TEXT_1')}
|
||||
</p>
|
||||
<a
|
||||
href={siteConfig('STARTER_FEATURE_1_BUTTON_URL')}
|
||||
<Link
|
||||
href={siteConfig('STARTER_FEATURE_1_BUTTON_URL', '')}
|
||||
className='text-base font-medium text-dark hover:text-primary dark:text-white dark:hover:text-primary'>
|
||||
{siteConfig('STARTER_FEATURE_1_BUTTON_TEXT')}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className='w-full px-4 md:w-1/2 lg:w-1/4'>
|
||||
@@ -60,11 +61,11 @@ export const Features = () => {
|
||||
<p className='mb-8 text-body-color dark:text-dark-6 lg:mb-9'>
|
||||
{siteConfig('STARTER_FEATURE_2_TEXT_1')}
|
||||
</p>
|
||||
<a
|
||||
href={siteConfig('STARTER_FEATURE_2_BUTTON_URL')}
|
||||
<Link
|
||||
href={siteConfig('STARTER_FEATURE_2_BUTTON_URL', '')}
|
||||
className='text-base font-medium text-dark hover:text-primary dark:text-white dark:hover:text-primary'>
|
||||
{siteConfig('STARTER_FEATURE_2_BUTTON_TEXT')}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className='w-full px-4 md:w-1/2 lg:w-1/4'>
|
||||
@@ -79,11 +80,11 @@ export const Features = () => {
|
||||
<p className='mb-8 text-body-color dark:text-dark-6 lg:mb-9'>
|
||||
{siteConfig('STARTER_FEATURE_3_TEXT_1')}
|
||||
</p>
|
||||
<a
|
||||
href={siteConfig('STARTER_FEATURE_3_BUTTON_URL')}
|
||||
<Link
|
||||
href={siteConfig('STARTER_FEATURE_3_BUTTON_URL', '')}
|
||||
className='text-base font-medium text-dark hover:text-primary dark:text-white dark:hover:text-primary'>
|
||||
{siteConfig('STARTER_FEATURE_3_BUTTON_TEXT')}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className='w-full px-4 md:w-1/2 lg:w-1/4'>
|
||||
@@ -98,11 +99,11 @@ export const Features = () => {
|
||||
<p className='mb-8 text-body-color dark:text-dark-6 lg:mb-9'>
|
||||
{siteConfig('STARTER_FEATURE_4_TEXT_1')}
|
||||
</p>
|
||||
<a
|
||||
href={siteConfig('STARTER_FEATURE_4_BUTTON_URL')}
|
||||
<Link
|
||||
href={siteConfig('STARTER_FEATURE_4_BUTTON_URL', '')}
|
||||
className='text-base font-medium text-dark hover:text-primary dark:text-white dark:hover:text-primary'>
|
||||
{siteConfig('STARTER_FEATURE_3_BUTTON_TEXT')}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { siteConfig } from '@/lib/config'
|
||||
import SocialButton from '@/themes/fukasawa/components/SocialButton'
|
||||
import { Logo } from './Logo'
|
||||
import { SVGFooterCircleBG } from './svg/SVGFooterCircleBG'
|
||||
import Link from 'next/link'
|
||||
|
||||
/* eslint-disable @next/next/no-img-element */
|
||||
export const Footer = props => {
|
||||
@@ -48,11 +49,11 @@ export const Footer = props => {
|
||||
{item?.LINK_GROUP?.map((l, i) => {
|
||||
return (
|
||||
<li key={i}>
|
||||
<a
|
||||
<Link
|
||||
href={l.URL}
|
||||
className='mb-3 inline-block text-base text-gray-7 hover:text-primary'>
|
||||
{l.TITLE}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
@@ -72,7 +73,7 @@ export const Footer = props => {
|
||||
<div className='flex flex-col gap-8'>
|
||||
{latestPosts?.map((item, index) => {
|
||||
return (
|
||||
<a
|
||||
<Link
|
||||
key={index}
|
||||
href={item?.href}
|
||||
className='group flex items-center gap-[22px]'>
|
||||
@@ -87,7 +88,7 @@ export const Footer = props => {
|
||||
<span className='line-clamp-2 max-w-[180px] text-base text-gray-7 group-hover:text-white'>
|
||||
{item.title}
|
||||
</span>
|
||||
</a>
|
||||
</Link>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
@@ -104,27 +105,27 @@ export const Footer = props => {
|
||||
<div className='w-full px-4 md:w-2/3 lg:w-1/2'>
|
||||
<div className='my-1'>
|
||||
<div className='-mx-3 flex items-center justify-center md:justify-start'>
|
||||
<a
|
||||
href={siteConfig('STARTER_FOOTER_PRIVACY_POLICY_URL')}
|
||||
<Link
|
||||
href={siteConfig('STARTER_FOOTER_PRIVACY_POLICY_URL', '')}
|
||||
className='px-3 text-base text-gray-7 hover:text-white hover:underline'>
|
||||
{siteConfig('STARTER_FOOTER_PRIVACY_POLICY_TEXT')}
|
||||
</a>
|
||||
<a
|
||||
</Link>
|
||||
<Link
|
||||
href={siteConfig(
|
||||
'STARTER_FOOTER_PRIVACY_LEGAL_NOTICE_URL'
|
||||
'STARTER_FOOTER_PRIVACY_LEGAL_NOTICE_URL', ''
|
||||
)}
|
||||
className='px-3 text-base text-gray-7 hover:text-white hover:underline'>
|
||||
{siteConfig('STARTER_FOOTER_PRIVACY_LEGAL_NOTICE_TEXT')}
|
||||
</a>
|
||||
<a
|
||||
</Link>
|
||||
<Link
|
||||
href={siteConfig(
|
||||
'STARTER_FOOTER_PRIVACY_TERMS_OF_SERVICE_URL'
|
||||
'STARTER_FOOTER_PRIVACY_TERMS_OF_SERVICE_URL', ''
|
||||
)}
|
||||
className='px-3 text-base text-gray-7 hover:text-white hover:underline'>
|
||||
{siteConfig(
|
||||
'STARTER_FOOTER_PRIVACY_TERMS_OF_SERVICE_TEXT'
|
||||
'STARTER_FOOTER_PRIVACY_TERMS_OF_SERVICE_TEXT', ''
|
||||
)}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -75,12 +75,12 @@ export const Header = props => {
|
||||
<SignedOut>
|
||||
<div className='hidden sm:flex gap-4'>
|
||||
<Link
|
||||
href={siteConfig('STARTER_NAV_BUTTON_1_URL')}
|
||||
href={siteConfig('STARTER_NAV_BUTTON_1_URL', '')}
|
||||
className={`loginBtn ${buttonTextColor} p-2 text-base font-medium hover:opacity-70`}>
|
||||
{siteConfig('STARTER_NAV_BUTTON_1_TEXT')}
|
||||
</Link>
|
||||
<Link
|
||||
href={siteConfig('STARTER_NAV_BUTTON_2_URL')}
|
||||
href={siteConfig('STARTER_NAV_BUTTON_2_URL', '')}
|
||||
className={`signUpBtn ${buttonTextColor} p-2 rounded-md bg-white bg-opacity-20 py-2 text-base font-medium duration-300 ease-in-out hover:bg-opacity-100 hover:text-dark`}>
|
||||
{siteConfig('STARTER_NAV_BUTTON_2_TEXT')}
|
||||
</Link>
|
||||
@@ -94,16 +94,16 @@ export const Header = props => {
|
||||
)}
|
||||
{!enableClerk && (
|
||||
<div className='hidden sm:flex gap-4'>
|
||||
<a
|
||||
href={siteConfig('STARTER_NAV_BUTTON_1_URL')}
|
||||
<Link
|
||||
href={siteConfig('STARTER_NAV_BUTTON_1_URL', '')}
|
||||
className={`loginBtn ${buttonTextColor} p-2 text-base font-medium hover:opacity-70`}>
|
||||
{siteConfig('STARTER_NAV_BUTTON_1_TEXT')}
|
||||
</a>
|
||||
<a
|
||||
href={siteConfig('STARTER_NAV_BUTTON_2_URL')}
|
||||
</Link>
|
||||
<Link
|
||||
href={siteConfig('STARTER_NAV_BUTTON_2_URL', '')}
|
||||
className={`signUpBtn ${buttonTextColor} p-2 rounded-md bg-white bg-opacity-20 py-2 text-base font-medium duration-300 ease-in-out hover:bg-opacity-100 hover:text-dark`}>
|
||||
{siteConfig('STARTER_NAV_BUTTON_2_TEXT')}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import LazyImage from '@/components/LazyImage'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import CONFIG from '../config'
|
||||
import Link from 'next/link'
|
||||
|
||||
/**
|
||||
* 英雄大图区块
|
||||
@@ -32,16 +33,16 @@ export const Hero = props => {
|
||||
<ul className='mb-10 flex flex-wrap items-center justify-center gap-5'>
|
||||
{siteConfig('STARTER_HERO_BUTTON_1_TEXT', null, config) && (
|
||||
<li>
|
||||
<a
|
||||
href={siteConfig('STARTER_HERO_BUTTON_1_URL')}
|
||||
<Link
|
||||
href={siteConfig('STARTER_HERO_BUTTON_1_URL', '')}
|
||||
className='inline-flex items-center justify-center rounded-md bg-white px-7 py-[14px] text-center text-base font-medium text-dark shadow-1 transition duration-300 ease-in-out hover:bg-gray-2 hover:text-body-color'>
|
||||
{siteConfig('STARTER_HERO_BUTTON_1_TEXT', null, config)}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
)}
|
||||
{siteConfig('STARTER_HERO_BUTTON_2_TEXT', null, config) && (
|
||||
<li>
|
||||
<a
|
||||
<Link
|
||||
href={siteConfig(
|
||||
'STARTER_HERO_BUTTON_2_URL',
|
||||
null,
|
||||
@@ -65,7 +66,7 @@ export const Hero = props => {
|
||||
/>
|
||||
)}
|
||||
{siteConfig('STARTER_HERO_BUTTON_2_TEXT', null, config)}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
)}
|
||||
</ul>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import Link from 'next/link'
|
||||
|
||||
/**
|
||||
* 价格板块
|
||||
@@ -65,11 +66,11 @@ export const Pricing = () => {
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<a
|
||||
href={siteConfig('STARTER_PRICING_1_BUTTON_URL')}
|
||||
<Link
|
||||
href={siteConfig('STARTER_PRICING_1_BUTTON_URL', '')}
|
||||
className='inline-block rounded-md bg-primary px-7 py-3 text-center text-base font-medium text-white transition hover:bg-blue-dark'>
|
||||
{siteConfig('STARTER_PRICING_1_BUTTON_TEXT')}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -117,11 +118,11 @@ export const Pricing = () => {
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<a
|
||||
href={siteConfig('STARTER_PRICING_2_BUTTON_URL')}
|
||||
<Link
|
||||
href={siteConfig('STARTER_PRICING_2_BUTTON_URL', '')}
|
||||
className='inline-block rounded-md bg-primary px-7 py-3 text-center text-base font-medium text-white transition hover:bg-blue-dark'>
|
||||
{siteConfig('STARTER_PRICING_2_BUTTON_TEXT')}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -161,11 +162,11 @@ export const Pricing = () => {
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<a
|
||||
href={siteConfig('STARTER_PRICING_3_BUTTON_URL')}
|
||||
<Link
|
||||
href={siteConfig('STARTER_PRICING_3_BUTTON_URL', '')}
|
||||
className='inline-block rounded-md bg-primary px-7 py-3 text-center text-base font-medium text-white transition hover:bg-blue-dark'>
|
||||
{siteConfig('STARTER_PRICING_3_BUTTON_TEXT')}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user