👅 配置文件移入config.js

This commit is contained in:
tangly1024
2021-09-29 13:08:52 +08:00
parent 84137cef6f
commit a9f99ae51a
3 changed files with 29 additions and 31 deletions

View File

@@ -57,7 +57,8 @@ const BLOG = {
}
},
isProd: process.env.VERCEL_ENV === 'production', // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables)
googleAdsense: true
googleAdsenseId: 'ca-pub-2708419466378217',
DaoVoiceId: 'daf1a94b' // DaoVoice http://dashboard.daovoice.io/get-started
}
// export default BLOG
module.exports = BLOG

View File

@@ -41,7 +41,7 @@ const SideBar = ({ tags, currentTag, toc }) => {
return <aside className='z-10'>
<div
className={(collapse ? '-ml-80 ' : 'shadow-2xl xl:shadow-none') + ' dark:bg-gray-800 bg-white sidebar h-full w-60 duration-500 ease-in-out'}>
className={(collapse ? '-ml-80 ' : 'shadow-2xl xl:shadow-none') + ' dark:bg-gray-800 bg-white sidebar h-full w-72 duration-500 ease-in-out'}>
{/* Logo */}
<section className='mx-5 pt-6 pb-2'>
@@ -109,7 +109,7 @@ const SideBar = ({ tags, currentTag, toc }) => {
{/* 顶部菜单按钮 */}
<div
className={(collapse ? 'left-0' : 'left-60') + ' fixed flex flex-nowrap md:flex-col top-0 pl-4 py-1 duration-500 ease-in-out'}>
className={(collapse ? 'left-0' : 'left-72') + ' fixed flex flex-nowrap md:flex-col top-0 pl-4 py-1 duration-500 ease-in-out'}>
{/* 菜单折叠 */}
<div className='z-30 p-1 border hover:shadow-xl duration-200 dark:border-gray-500 h-12 bg-white dark:bg-gray-600 dark:bg-opacity-70 bg-opacity-70
dark:hover:bg-gray-100 text-xl cursor-pointer mr-2 my-2 dark:text-gray-300 dark:hover:text-black'>

View File

@@ -1,41 +1,41 @@
import BLOG from '@/blog.config'
const ThirdPartyScript = () => {
return <>
{/* DaoVoice http://dashboard.daovoice.io/get-started */}
<script dangerouslySetInnerHTML={{
__html: `
return (<>
{BLOG.DaoVoiceId && (<>
{/* DaoVoice 反馈 */}
<script dangerouslySetInnerHTML={{
__html: `
(function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/daf1a94b.js","daovoice")
`
}}
/>
<script async dangerouslySetInnerHTML={{
__html: `
}}
/>
<script async dangerouslySetInnerHTML={{
__html: `
daovoice('init', {
app_id: "daf1a94b"
app_id: "${BLOG.DaoVoiceId}"
});
daovoice('update');
`
}}
/>
{/* GoogleAdsense */}
{ BLOG.isProd && (
<>
{BLOG.googleAdsense && (
<script data-ad-client='ca-pub-2708419466378217' async
}}
/>
</>)}
{/* 代码统计 */}
{BLOG.isProd && (<>
{/* GoogleAdsense */}
{BLOG.googleAdsenseId && (
<script data-ad-client={BLOG.googleAdsenseId} async
src='https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js' />
)}
{/* 统计脚本 */}
{ BLOG.analytics.provider === 'ackee' && (
{/* ackee统计脚本 */}
{BLOG.analytics.provider === 'ackee' && (
<script async src={BLOG.analytics.ackeeConfig.tracker}
data-ackee-server={BLOG.analytics.ackeeConfig.dataAckeeServer}
data-ackee-domain-id={BLOG.analytics.ackeeConfig.domainId}
/>
)}
{/* 百度 */}
{/* 百度统计 */}
{BLOG.analytics.baidyAnalytics && (
<script async
dangerouslySetInnerHTML={{
@@ -70,8 +70,7 @@ const ThirdPartyScript = () => {
)}
{/* 谷歌统计 */}
{BLOG.analytics.provider === 'ga' && (
<>
{BLOG.analytics.provider === 'ga' && (<>
<script async
src={`https://www.googletagmanager.com/gtag/js?id=${BLOG.analytics.gaConfig.measurementId}`}
/>
@@ -87,11 +86,9 @@ const ThirdPartyScript = () => {
`
}}
/>
</>
)}
</>
)}
</>
</>)}
</>)}
</>)
}
export default ThirdPartyScript