From b2d2afc7045aa69002ed7b92ec3f1527a121a96c Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Mon, 13 Dec 2021 16:21:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E4=BD=93=E8=B0=83=E6=95=B4=EF=BC=8C?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 ++++++++++++++ blog.config.js | 13 +++++++------ components/CategoryGroup.js | 2 +- components/LatestPostsGroup.js | 2 +- components/MenuButtonGroup.js | 7 ++++--- components/SearchInput.js | 2 +- components/SideBar.js | 2 +- layouts/BaseLayout.js | 3 +-- pages/article/[slug].js | 4 ++-- 9 files changed, 32 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 51825621..ea2e5d67 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,20 @@ - Notion token 的有效期只有 180 天,请确保在 Vercel Dashboard 上手动更新,我们可能会在未来切换到官方 API 来解决这个问题。此外,如果数据库是非公开到,Notion 中的图片可能无法正常显示到网页上。 - **稍微等等就可以访问了!** 简单吗? + +## 快速开发 + +```bash +yarn # 安装依赖 + +yarn run dev # 本地开发 + +yarn run build # 本地打包编译 + +yarn run start # 本地启动NextJS服务 + +``` + ## 引用技术 - **生成**: Next.js SSG 和 Incremental Static Regeneration diff --git a/blog.config.js b/blog.config.js index 082c10ce..dd007a5b 100644 --- a/blog.config.js +++ b/blog.config.js @@ -9,19 +9,19 @@ const BLOG = { notionAccessToken: process.env.NOTION_ACCESS_TOKEN || '', // Useful if you prefer not to make your database public defaultImgCover: 'https://avatars.githubusercontent.com/u/15920488', // default image cover appearance: 'auto', // ['light', 'dark', 'auto'], - font: 'font-sans', // ['font-sans', 'font-serif', 'font-mono'] + font: 'font-serif tracking-wider subpixel-antialiased', // 文章字体 ['font-sans', 'font-serif', 'font-mono'] @see https://www.tailwindcss.cn/docs/font-family lightBackground: '#ffffff', // use hex value, don't forget '#' e.g #fffefc darkBackground: '#111827', // use hex value, don't forget '#' path: '', // leave this empty unless you want to deploy in a folder since: 2020, // if leave this empty, current year will be used. postsPerPage: 6, // post counts per page sortByDate: false, - showAbout: true, // WIP - showArchive: true, // WIP + showAbout: true, // WIP 是否显示关于 + showArchive: true, // WIP 是否显示归档 autoCollapsedNavBar: false, // the automatically collapsed navigation bar socialLink: 'https://weibo.com/u/2245301913', seo: { - keywords: ['建站', 'Notion', '赚钱', '写作', '副业'], + keywords: ['Notion', '写作', '博客'], googleSiteVerification: '' // Remove the value or replace it with your own google site verification code }, analytics: { @@ -58,10 +58,11 @@ const BLOG = { repo: 'tangly1024/NotionNext' } }, - isProd: process.env.VERCEL_ENV === 'production', // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables) googleAdsenseId: 'ca-pub-2708419466378217', // 谷歌广告ID DaoVoiceId: '', // 在线聊天 DaoVoice http://dashboard.daovoice.io/get-started - TidioId: '' // 在线聊天 https://www.tidio.com/ + TidioId: '', // 在线聊天 https://www.tidio.com/ + isProd: process.env.VERCEL_ENV === 'production' // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables) + } // export default BLOG module.exports = BLOG diff --git a/components/CategoryGroup.js b/components/CategoryGroup.js index f182b9d6..3e7ca5f5 100644 --- a/components/CategoryGroup.js +++ b/components/CategoryGroup.js @@ -12,7 +12,7 @@ const CategoryGroup = ({ currentCategory, categories }) => {
+ ' duration-300 hover:text-blue-500 dark:hover:text-blue-400 hover:underline px-5 cursor-pointer pt-2 font-light'}> {category}({categories[category]})
})} diff --git a/components/LatestPostsGroup.js b/components/LatestPostsGroup.js index 3c5fd670..811dde22 100644 --- a/components/LatestPostsGroup.js +++ b/components/LatestPostsGroup.js @@ -31,7 +31,7 @@ const LatestPostsGroup = ({ posts, sliceCount = 5 }) => { const selected = currentPath === `${BLOG.path}/article/${post.slug}` return ( -
+
{ const { locale } = useGlobal() const router = useRouter() const links = [ { id: 0, icon: faHome, name: locale.NAV.INDEX, to: '/' || '/', show: true }, - { id: 1, icon: faArchive, name: locale.NAV.ARCHIVE, to: '/archive', show: true }, - { id: 2, icon: faInfoCircle, name: locale.NAV.ABOUT, to: '/article/about', show: true } + { id: 1, icon: faArchive, name: locale.NAV.ARCHIVE, to: '/archive', show: BLOG.showArchive }, + { id: 2, icon: faInfoCircle, name: locale.NAV.ABOUT, to: '/article/about', show: BLOG.showAbout } // { id: 7, icon: 'faGithub', name: 'Github', to: 'https://github.com/tangly1024', show: true }, // { id: 5, icon: 'faWeibo', name: '微博', to: 'https://weibo.com/tangly1024', show: true }, // { id: 4, icon: 'faEnvelope', name: locale.NAV.MAIL, to: 'mailto:tlyong1992@hotmail.com', show: true } @@ -27,7 +28,7 @@ const MenuButtonGroup = ({ allowCollapse = false }) => { if (link.show) { const selected = (router.pathname === link.to) || (router.asPath === link.to) return -
diff --git a/components/SearchInput.js b/components/SearchInput.js index 8648aa09..424a8d60 100644 --- a/components/SearchInput.js +++ b/components/SearchInput.js @@ -42,7 +42,7 @@ const SearchInput = ({ currentTag, currentSearch }) => { ref={searchInputRef} type='text' placeholder={currentTag ? `${locale.SEARCH.TAGS} #${currentTag}` : `${locale.SEARCH.ARTICLES}`} - className={'w-full pl-2 transition leading-10 border-gray-300 text-black bg-gray-100 dark:bg-gray-900 dark:text-white'} + className={'w-full pl-2 transition font-light leading-10 border-gray-300 text-black bg-gray-100 dark:bg-gray-900 dark:text-white'} onKeyUp={handleKeyUp} onChange={e => updateSearchKey(e.target.value)} defaultValue={currentSearch} diff --git a/components/SideBar.js b/components/SideBar.js index 5ad963fb..1fdd730f 100644 --- a/components/SideBar.js +++ b/components/SideBar.js @@ -83,7 +83,7 @@ const SideBar = ({ tags, currentTag, post, posts, categories, currentCategory, c {post && (
-
+
{locale.COMMON.TABLE_OF_CONTENTS}
diff --git a/layouts/BaseLayout.js b/layouts/BaseLayout.js index 0e9bf7a2..80eb38e7 100644 --- a/layouts/BaseLayout.js +++ b/layouts/BaseLayout.js @@ -66,7 +66,7 @@ const BaseLayout = ({ const targetRef = useRef(null) return ( -
+
{/* 顶部导航栏 */} @@ -78,7 +78,6 @@ const BaseLayout = ({
- {onLoading ? :
diff --git a/pages/article/[slug].js b/pages/article/[slug].js index 1f03857e..c9fcbc29 100644 --- a/pages/article/[slug].js +++ b/pages/article/[slug].js @@ -85,13 +85,13 @@ const ArticleDetail = ({ post, blockMap, tags, prev, next, allPosts, categories
-
+
{post.summary}
{/* Notion文章主体 */} {blockMap && ( -