From 1a4d4c15f95f44e2bf44214347cc3ea13cf1a77c Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Sat, 3 Feb 2024 19:29:03 +0800 Subject: [PATCH 01/18] =?UTF-8?q?Nav=20=E4=B8=BB=E9=A2=98=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getNotionData.js | 2 +- themes/nav/components/MenuItem.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index 32089e30..122efb0c 100755 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -142,7 +142,7 @@ function getCustomNav({ allPages }) { * @returns */ function getCustomMenu({ collectionData }) { - const menuPages = collectionData.filter(post => (post?.type === BLOG.NOTION_PROPERTY_NAME.type_menu || post?.type === BLOG.NOTION_PROPERTY_NAME.type_sub_menu) && post.status === 'Published') + const menuPages = collectionData.filter(post => post.status === 'Published' && (post?.type === BLOG.NOTION_PROPERTY_NAME.type_menu || post?.type === BLOG.NOTION_PROPERTY_NAME.type_sub_menu)) const menus = [] if (menuPages && menuPages.length > 0) { menuPages.forEach(e => { diff --git a/themes/nav/components/MenuItem.js b/themes/nav/components/MenuItem.js index 539a9222..d44f8b17 100644 --- a/themes/nav/components/MenuItem.js +++ b/themes/nav/components/MenuItem.js @@ -22,7 +22,7 @@ export const MenuItem = ({ link }) => { // #号加标题 快速跳转到指定锚点 const isAnchor = link?.to === '#' - const url = isAnchor ? link.to : `#${link.name}` + const url = isAnchor ? `#${link.name}` : link.to return <> {/* 菜单 */} @@ -33,7 +33,7 @@ export const MenuItem = ({ link }) => { {link?.subMenus ? (<> - {link?.title} + {link?.title}
From c15f69230ce94c27b73973d7b770ba923f37909e Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Sun, 4 Feb 2024 11:58:55 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E5=AD=97=E4=BD=93=E7=B2=97=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blog.config.js | 5 +++-- pages/_document.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/blog.config.js b/blog.config.js index f038e23f..4677c555 100644 --- a/blog.config.js +++ b/blog.config.js @@ -45,8 +45,9 @@ const BLOG = { // 默认下会将你上传到 notion的主页封面图和头像也给替换,建议将主页封面图和头像放在其他图床,在 notion 里配置 link 即可。 // START ************网站字体***************** - - FONT_STYLE: process.env.NEXT_PUBLIC_FONT_STYLE || 'font-sans', // ['font-serif','font-sans'] 两种可选,分别是衬线和无衬线: 参考 https://www.jianshu.com/p/55e410bd2115 + // ['font-serif','font-sans'] 两种可选,分别是衬线和无衬线: 参考 https://www.jianshu.com/p/55e410bd2115 + // 后面空格隔开的font-light的字体粗细,留空是默认粗细;参考 https://www.tailwindcss.cn/docs/font-weight + FONT_STYLE: process.env.NEXT_PUBLIC_FONT_STYLE || 'font-sans font-light', // 字体CSS 例如 https://npm.elemecdn.com/lxgw-wenkai-webfont@1.6.0/style.css FONT_URL: [ // 'https://npm.elemecdn.com/lxgw-wenkai-webfont@1.6.0/style.css', diff --git a/pages/_document.js b/pages/_document.js index e1e78253..a790e769 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -28,7 +28,7 @@ class MyDocument extends Document { })} - +
From 0b91bfb211d4481e98700160f37914e3f148b56c Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Sun, 4 Feb 2024 16:38:18 +0800 Subject: [PATCH 03/18] fix simple build --- themes/simple/components/ArticleInfo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/simple/components/ArticleInfo.js b/themes/simple/components/ArticleInfo.js index 37f4c5c9..d8f666cc 100644 --- a/themes/simple/components/ArticleInfo.js +++ b/themes/simple/components/ArticleInfo.js @@ -27,7 +27,7 @@ export default function ArticleInfo (props) { {siteConfig('AUTHOR')} {post?.publishDay} {post?.category && {post?.category}} - {post?.tags && post?.tags?.length > 0 && post?.tags.map(t => / {t})} + {post?.tags && post?.tags?.length > 0 && post?.tags.map(t => /
{t}
)}
)} {post?.type !== 'Page' && (
From 4f957e7e92355696b7b5d2841dc66932b181a40d Mon Sep 17 00:00:00 2001 From: kazoottt Date: Sun, 4 Feb 2024 16:56:45 +0800 Subject: [PATCH 04/18] feat: highlight the selected tag --- themes/heo/components/TagGroups.js | 46 ++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/themes/heo/components/TagGroups.js b/themes/heo/components/TagGroups.js index 7c8ae0e6..a74a43b3 100644 --- a/themes/heo/components/TagGroups.js +++ b/themes/heo/components/TagGroups.js @@ -1,4 +1,5 @@ import Link from 'next/link' +import { useRouter } from 'next/router' /** * 标签组 @@ -9,22 +10,37 @@ import Link from 'next/link' */ const TagGroups = ({ tags, className }) => { if (!tags) return <> - return ( -
- { - tags.map((tag, index) => { - return -
-
{tag.name}
{tag.count ? {tag.count} : <>} -
- - }) - } -
+ const router = useRouter() + const { tag: currentTag } = router.query + + return ( +
+ {tags.map((tag, index) => { + const selected = currentTag === tag.name + return ( + +
+
{tag.name}
+ {tag.count ? ( + {tag.count} + ) : ( + <> + )} +
+ + ) + })} +
) } From e904b47e7678e8073a1118a183a1eacbf9052a67 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Sun, 4 Feb 2024 17:49:18 +0800 Subject: [PATCH 05/18] =?UTF-8?q?=E8=8F=9C=E5=8D=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getNotionData.js | 16 ++++++++++++++-- themes/gitbook/components/MenuItemDrop.js | 4 +--- themes/nav/index.js | 1 - 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index 122efb0c..9a1dff7c 100755 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -119,6 +119,7 @@ export async function getNotionPageData({ pageId, from }) { /** * 获取用户自定义单页菜单 + * 旧版本,不读取Menu菜单,而是读取type=Page生成菜单 * @param notionPageData * @returns {Promise<[]|*[]>} */ @@ -126,11 +127,16 @@ function getCustomNav({ allPages }) { const customNav = [] if (allPages && allPages.length > 0) { allPages.forEach(p => { + p.to = p.slug if (p?.slug?.indexOf('http') === 0) { - customNav.push({ icon: p.icon || null, name: p.title, to: p.slug, target: '_blank', show: true }) + p.target = '_blank' } else { - customNav.push({ icon: p.icon || null, name: p.title, to: '/' + p.slug, target: '_self', show: true }) + p.target = '_self' + if (p?.slug?.indexOf('/') !== 0) { + p.to = '/' + p.slug + } } + customNav.push({ icon: p.icon || null, name: p.title, to: p.slug, target: '_blank', show: true }) }) } return customNav @@ -149,6 +155,12 @@ function getCustomMenu({ collectionData }) { e.show = true if (e?.slug?.indexOf('http') === 0) { e.target = '_blank' + e.to = e.slug + } else { + e.target = '_self' + if (e?.slug?.indexOf('/') !== 0) { + e.to = '/' + e.slug + } } if (e.type === BLOG.NOTION_PROPERTY_NAME.type_menu) { menus.push(e) diff --git a/themes/gitbook/components/MenuItemDrop.js b/themes/gitbook/components/MenuItemDrop.js index c3636ba0..6c197700 100644 --- a/themes/gitbook/components/MenuItemDrop.js +++ b/themes/gitbook/components/MenuItemDrop.js @@ -4,8 +4,6 @@ import { useRouter } from 'next/router' export const MenuItemDrop = ({ link }) => { const [show, changeShow] = useState(false) - // const show = true - // const changeShow = () => {} const router = useRouter() if (!link || !link.show) { @@ -13,7 +11,7 @@ export const MenuItemDrop = ({ link }) => { } const hasSubMenu = link?.subMenus?.length > 0 const selected = (router.pathname === link.to) || (router.asPath === link.to) - + console.log('link', link?.to) return
  • changeShow(true)} onMouseOut={() => changeShow(false)} > {hasSubMenu && diff --git a/themes/nav/index.js b/themes/nav/index.js index b7e8b796..c8006469 100755 --- a/themes/nav/index.js +++ b/themes/nav/index.js @@ -213,7 +213,6 @@ const LayoutPostList = props => { */ const LayoutSlug = (props) => { const { post, lock, validPassword } = props - return ( <> {/* 文章锁 */} From e1a2ead2be7c3a0821aace530bd1ea0bf5cd9037 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Sun, 4 Feb 2024 17:52:43 +0800 Subject: [PATCH 06/18] check --- themes/heo/components/TagGroups.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/themes/heo/components/TagGroups.js b/themes/heo/components/TagGroups.js index a74a43b3..5087ad5f 100644 --- a/themes/heo/components/TagGroups.js +++ b/themes/heo/components/TagGroups.js @@ -9,10 +9,9 @@ import { useRouter } from 'next/router' * @constructor */ const TagGroups = ({ tags, className }) => { - if (!tags) return <> - const router = useRouter() const { tag: currentTag } = router.query + if (!tags) return <> return (
    @@ -31,11 +30,13 @@ const TagGroups = ({ tags, className }) => { flex items-center hover:bg-blue-600 dark:hover:bg-yellow-600 hover:scale-110 hover:text-white rounded-lg px-2 py-0.5 duration-150 transition-all`} >
    {tag.name}
    - {tag.count ? ( + {tag.count + ? ( {tag.count} - ) : ( + ) + : ( <> - )} + )}
    ) From 26ca5cde27ef4f3027a3fc54f4ff8669f5e6cafa Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Sun, 4 Feb 2024 17:58:16 +0800 Subject: [PATCH 07/18] check --- themes/heo/components/TagGroups.js | 52 ++++++++++++++---------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/themes/heo/components/TagGroups.js b/themes/heo/components/TagGroups.js index 5087ad5f..34bf1839 100644 --- a/themes/heo/components/TagGroups.js +++ b/themes/heo/components/TagGroups.js @@ -14,34 +14,30 @@ const TagGroups = ({ tags, className }) => { if (!tags) return <> return ( -
    - {tags.map((tag, index) => { - const selected = currentTag === tag.name - return ( - -
    -
    {tag.name}
    - {tag.count - ? ( - {tag.count} - ) - : ( - <> - )} -
    - - ) - })} -
    +
    + {tags.map((tag, index) => { + const selected = currentTag === tag.name + return ( + +
    +
    {tag.name}
    + {tag.count + ? ( + {tag.count} + ) + : ( + <> + )} +
    + + ) + })} +
    ) } From 9b80f7c3d12ca9e66d325fa8889ecbfb64cf7db0 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Sun, 4 Feb 2024 18:17:15 +0800 Subject: [PATCH 08/18] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 153 ++++++++++++++++++++++++++------------------------- yarn.lock | 5 ++ 2 files changed, 82 insertions(+), 76 deletions(-) diff --git a/package.json b/package.json index 6a679668..df145844 100644 --- a/package.json +++ b/package.json @@ -1,77 +1,78 @@ { - "name": "notion-next", - "version": "4.2.3", - "homepage": "https://github.com/tangly1024/NotionNext.git", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/tangly1024/NotionNext.git" - }, - "author": { - "name": "tangly", - "email": "mail@tangly1024.com", - "url": "http://tangly1024.com" - }, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "post-build": "next-sitemap --config next-sitemap.config.js", - "export": "next build && next-sitemap --config next-sitemap.config.js && next export", - "bundle-report": "ANALYZE=true yarn build" - }, - "dependencies": { - "@giscus/react": "^2.2.6", - "@headlessui/react": "^1.7.15", - "@next/bundle-analyzer": "^12.1.1", - "@vercel/analytics": "^1.0.0", - "algoliasearch": "^4.18.0", - "animejs": "^3.2.1", - "aos": "^3.0.0-beta.6", - "axios": ">=0.21.1", - "copy-to-clipboard": "^3.3.1", - "eslint-plugin-react-hooks": "^4.6.0", - "feed": "^4.2.2", - "js-md5": "^0.7.3", - "localStorage": "^1.0.4", - "lodash.throttle": "^4.1.1", - "memory-cache": "^0.2.0", - "mongodb": "^4.6.0", - "next": "13.3.1", - "notion-client": "6.15.6", - "notion-utils": "6.15.6", - "nprogress": "^0.2.0", - "preact": "^10.5.15", - "prism-themes": "1.9.0", - "react": "^18.2.0", - "react-cookies": "^0.1.1", - "react-dom": "^18.2.0", - "react-facebook": "^8.1.4", - "react-notion-x": "6.16.0", - "react-share": "^4.4.1", - "react-tweet-embed": "~2.0.0", - "typed.js": "^2.0.12" - }, - "devDependencies": { - "@waline/client": "^2.5.1", - "autoprefixer": "^10.4.13", - "eslint": "^7.26.0", - "eslint-config-next": "^13.1.1", - "eslint-config-standard": "^16.0.2", - "eslint-plugin-import": "^2.23.0", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-react": "^7.23.2", - "next-sitemap": "^1.6.203", - "postcss": "^8.4.31", - "tailwindcss": "^3.3.2", - "webpack-bundle-analyzer": "^4.5.0" - }, - "resolutions": { - "axios": ">=0.21.1" - }, - "bugs": { - "url": "https://github.com/tangly/NotionNext/issues", - "email": "tlyong1992@hotmail.com" - } -} + "name": "notion-next", + "version": "4.2.3", + "homepage": "https://github.com/tangly1024/NotionNext.git", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/tangly1024/NotionNext.git" + }, + "author": { + "name": "tangly", + "email": "mail@tangly1024.com", + "url": "http://tangly1024.com" + }, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "post-build": "next-sitemap --config next-sitemap.config.js", + "export": "next build && next-sitemap --config next-sitemap.config.js && next export", + "bundle-report": "ANALYZE=true yarn build" + }, + "dependencies": { + "@giscus/react": "^2.2.6", + "@headlessui/react": "^1.7.15", + "@next/bundle-analyzer": "^12.1.1", + "@vercel/analytics": "^1.0.0", + "algoliasearch": "^4.18.0", + "animejs": "^3.2.1", + "aos": "^3.0.0-beta.6", + "axios": ">=0.21.1", + "copy-to-clipboard": "^3.3.1", + "feed": "^4.2.2", + "js-md5": "^0.7.3", + "localStorage": "^1.0.4", + "lodash.throttle": "^4.1.1", + "memory-cache": "^0.2.0", + "mongodb": "^4.6.0", + "next": "13.3.1", + "notion-client": "6.15.6", + "notion-utils": "6.15.6", + "nprogress": "^0.2.0", + "preact": "^10.5.15", + "prism-themes": "1.9.0", + "react": "^18.2.0", + "react-cookies": "^0.1.1", + "react-dom": "^18.2.0", + "react-facebook": "^8.1.4", + "react-notion-x": "6.16.0", + "react-share": "^4.4.1", + "react-tweet-embed": "~2.0.0", + "typed.js": "^2.0.12" + }, + "devDependencies": { + "@waline/client": "^2.5.1", + "autoprefixer": "^10.4.13", + "eslint": "^7.26.0", + "eslint-config-next": "^13.1.1", + "eslint-config-standard": "^16.0.2", + "eslint-plugin-import": "^2.23.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^5.1.0", + "eslint-plugin-react": "^7.23.2", + "eslint-plugin-react-hooks": "^4.6.0", + "next-sitemap": "^1.6.203", + "postcss": "^8.4.31", + "prettier": "3.2.5", + "tailwindcss": "^3.3.2", + "webpack-bundle-analyzer": "^4.5.0" + }, + "resolutions": { + "axios": ">=0.21.1" + }, + "bugs": { + "url": "https://github.com/tangly/NotionNext/issues", + "email": "tlyong1992@hotmail.com" + } +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 2e04c14b..1d1a0511 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4131,6 +4131,11 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== +prettier@3.2.5: + version "3.2.5" + resolved "https://r.cnpmjs.org/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" + integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== + prism-themes@1.9.0: version "1.9.0" resolved "https://registry.yarnpkg.com/prism-themes/-/prism-themes-1.9.0.tgz#19c034f3205f1e28d75d89728e54ccd745f7e3dd" From 1e984d1108d232be37d39af2bc03ee9d3eda6560 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Sun, 4 Feb 2024 18:28:03 +0800 Subject: [PATCH 09/18] v4.2.4 --- .env.local | 2 +- lib/notion/getPostBlocks.js | 15 +++++---------- next.config.js | 2 +- package.json | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.env.local b/.env.local index 3cf57133..c2daaaed 100644 --- a/.env.local +++ b/.env.local @@ -1,5 +1,5 @@ # 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables -NEXT_PUBLIC_VERSION=4.2.3 +NEXT_PUBLIC_VERSION=4.2.4 # 可在此添加环境变量,去掉最左边的(# )注释即可 diff --git a/lib/notion/getPostBlocks.js b/lib/notion/getPostBlocks.js index 7c085993..69888b5d 100644 --- a/lib/notion/getPostBlocks.js +++ b/lib/notion/getPostBlocks.js @@ -18,10 +18,7 @@ export async function getPostBlocks(id, from, slice) { return filterPostBlocks(id, pageBlock, slice) } - const start = new Date().getTime() pageBlock = await getPageWithRetry(id, from) - const end = new Date().getTime() - console.log('[API耗时]', `${end - start}ms`) if (pageBlock) { await setDataToCache(cacheKey, pageBlock) @@ -38,10 +35,7 @@ export async function getSingleBlock(id, from) { return pageBlock } - const start = new Date().getTime() pageBlock = await getPageWithRetry(id, from) - const end = new Date().getTime() - console.log('[API耗时]', `${end - start}ms`) if (pageBlock) { await setDataToCache(cacheKey, pageBlock) @@ -56,16 +50,17 @@ export async function getSingleBlock(id, from) { */ export async function getPageWithRetry(id, from, retryAttempts = 3) { if (retryAttempts && retryAttempts > 0) { - console.log('[请求API]', `from:${from}`, `id:${id}`, retryAttempts < 3 ? `剩余重试次数:${retryAttempts}` : '') + console.log('[API-->>请求]', `from:${from}`, `id:${id}`, retryAttempts < 3 ? `剩余重试次数:${retryAttempts}` : '') try { const authToken = BLOG.NOTION_ACCESS_TOKEN || null const api = new NotionAPI({ authToken, userTimeZone: Intl.DateTimeFormat().resolvedOptions().timeZone }) + const start = new Date().getTime() const pageData = await api.getPage(id) - // console.log('stringfy', JSON.stringify(pageData)) - console.info('[响应成功]:', `from:${from}`) + const end = new Date().getTime() + console.log('[API<<--响应]', `耗时:${end - start}ms - from:${from}`) return pageData } catch (e) { - console.warn('[响应异常]:', e) + console.warn('[API<<--异常]:', e) await delay(1000) const cacheKey = 'page_block_' + id const pageBlock = await getDataFromCache(cacheKey) diff --git a/next.config.js b/next.config.js index f6dc572b..d0e32e96 100644 --- a/next.config.js +++ b/next.config.js @@ -94,7 +94,7 @@ module.exports = withBundleAnalyzer({ // } // 动态主题:添加 resolve.alias 配置,将动态路径映射到实际路径 if (!isServer) { - console.log('加载默认主题', path.resolve(__dirname, 'themes', THEME)) + console.log('[加载主题]', path.resolve(__dirname, 'themes', THEME)) } config.resolve.alias['@theme-components'] = path.resolve(__dirname, 'themes', THEME) return config diff --git a/package.json b/package.json index df145844..82efcf06 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notion-next", - "version": "4.2.3", + "version": "4.2.4", "homepage": "https://github.com/tangly1024/NotionNext.git", "license": "MIT", "repository": { From 26a625ede39acd0dcb23f517941227b742138c74 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Sun, 4 Feb 2024 18:29:22 +0800 Subject: [PATCH 10/18] fix --- themes/simple/components/ArticleInfo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/simple/components/ArticleInfo.js b/themes/simple/components/ArticleInfo.js index d8f666cc..f4d3f7fc 100644 --- a/themes/simple/components/ArticleInfo.js +++ b/themes/simple/components/ArticleInfo.js @@ -27,7 +27,7 @@ export default function ArticleInfo (props) { {siteConfig('AUTHOR')} {post?.publishDay} {post?.category && {post?.category}} - {post?.tags && post?.tags?.length > 0 && post?.tags.map(t => /
    {t}
    )} + {post?.tags && post?.tags?.length > 0 && post?.tags.map(t => / {t})}
  • )} {post?.type !== 'Page' && (
    From abb57056973c4ce1dfca14edc5f4094cda4ca4e8 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 5 Feb 2024 14:17:13 +0800 Subject: [PATCH 11/18] fix fukasawa menu --- themes/fukasawa/components/MenuItemCollapse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/fukasawa/components/MenuItemCollapse.js b/themes/fukasawa/components/MenuItemCollapse.js index 8251f3c7..f854c16f 100644 --- a/themes/fukasawa/components/MenuItemCollapse.js +++ b/themes/fukasawa/components/MenuItemCollapse.js @@ -44,7 +44,7 @@ export const MenuItemCollapse = (props) => {
    {link.name}
    } -
    f + {/* 折叠子菜单 */} {hasSubMenu && From a45320d1af4ec6430f5588697e03b2cc914b941a Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 5 Feb 2024 17:54:51 +0800 Subject: [PATCH 12/18] =?UTF-8?q?=E6=89=80=E6=9C=89=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20title=20icon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/example/components/BlogPostCard.js | 7 +- themes/example/components/Title.js | 4 +- themes/fukasawa/components/ArticleDetail.js | 3 +- themes/fukasawa/components/BlogCard.js | 21 +++-- themes/gitbook/index.js | 3 +- themes/heo/components/BlogPostCard.js | 15 ++-- themes/hexo/components/BlogPostCardInfo.js | 92 +++++++++++---------- themes/matery/components/BlogPostCard.js | 13 +-- themes/matery/components/PostHeader.js | 3 +- themes/medium/components/ArticleInfo.js | 3 +- themes/medium/components/BlogPostCard.js | 15 ++-- themes/nav/index.js | 3 +- themes/nobelium/components/ArticleInfo.js | 7 +- themes/nobelium/components/BlogPost.js | 3 +- themes/plog/components/ArticleInfo.js | 7 +- themes/plog/components/BlogPost.js | 3 +- themes/simple/components/ArticleInfo.js | 3 +- themes/simple/components/BlogItem.js | 17 ++-- 18 files changed, 126 insertions(+), 96 deletions(-) diff --git a/themes/example/components/BlogPostCard.js b/themes/example/components/BlogPostCard.js index a8783f8c..b66dcca3 100644 --- a/themes/example/components/BlogPostCard.js +++ b/themes/example/components/BlogPostCard.js @@ -4,6 +4,7 @@ import Link from 'next/link' import TwikooCommentCount from '@/components/TwikooCommentCount' import LazyImage from '@/components/LazyImage' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' +import NotionIcon from '@/components/NotionIcon' const BlogPostCard = ({ post }) => { const showPageCover = siteConfig('EXAMPLE_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail @@ -15,16 +16,18 @@ const BlogPostCard = ({ post }) => { - {post?.title} + {post?.title}
    by {siteConfig('AUTHOR')} on {post.date?.start_date || post.createdTime} + {post.category && <> | {post.category} - {/* | */} + } + {/* | */} {/* 2 Comments */}
    diff --git a/themes/example/components/Title.js b/themes/example/components/Title.js index 5c251b0d..4308611a 100644 --- a/themes/example/components/Title.js +++ b/themes/example/components/Title.js @@ -1,3 +1,4 @@ +import NotionIcon from '@/components/NotionIcon' import { siteConfig } from '@/lib/config' /** @@ -9,9 +10,10 @@ export const Title = (props) => { const { post } = props const title = post?.title || siteConfig('TITLE') const description = post?.description || siteConfig('AUTHOR') + console.log('post', post) return
    -

    {title}

    +

    {title}

    {description}

    diff --git a/themes/fukasawa/components/ArticleDetail.js b/themes/fukasawa/components/ArticleDetail.js index 1b9076a4..fb038e3d 100644 --- a/themes/fukasawa/components/ArticleDetail.js +++ b/themes/fukasawa/components/ArticleDetail.js @@ -9,6 +9,7 @@ import { AdSlot } from '@/components/GoogleAdsense' import LazyImage from '@/components/LazyImage' import { formatDateFmt } from '@/lib/formatDate' import WWAds from '@/components/WWAds' +import NotionIcon from '@/components/NotionIcon' /** * @@ -36,7 +37,7 @@ export default function ArticleDetail(props) { {/* 文章Title */}
    - {post.title} + {post.title}
    diff --git a/themes/fukasawa/components/BlogCard.js b/themes/fukasawa/components/BlogCard.js index 6c85bfc8..d54daaba 100644 --- a/themes/fukasawa/components/BlogCard.js +++ b/themes/fukasawa/components/BlogCard.js @@ -4,6 +4,7 @@ import TagItemMini from './TagItemMini' import CONFIG from '../config' import LazyImage from '@/components/LazyImage' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' +import NotionIcon from '@/components/NotionIcon' /** * 文章列表卡片 @@ -32,7 +33,7 @@ const BlogCard = ({ index, post, showSummary, siteInfo }) => { const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}` return ( -
    @@ -51,16 +52,18 @@ const BlogCard = ({ index, post, showSummary, siteInfo }) => { {/* 文字部分 */}
    - - {post.title} - +

    + + {post.title} + +

    {(!showPreview || showSummary) && ( -

    +

    {post.summary} -

    +
    )} {/* 分类标签 */} @@ -83,7 +86,7 @@ const BlogCard = ({ index, post, showSummary, siteInfo }) => {
    -
    + ) } diff --git a/themes/gitbook/index.js b/themes/gitbook/index.js index b141252a..cd4f2207 100644 --- a/themes/gitbook/index.js +++ b/themes/gitbook/index.js @@ -33,6 +33,7 @@ import BlogArchiveItem from './components/BlogArchiveItem' import Link from 'next/link' import dynamic from 'next/dynamic' import { siteConfig } from '@/lib/config' +import NotionIcon from '@/components/NotionIcon' const WWAds = dynamic(() => import('@/components/WWAds'), { ssr: false }) // 主题全局变量 @@ -219,7 +220,7 @@ const LayoutSlug = (props) => { {!lock &&
    {/* title */} -

    {post?.title}

    +

    {post?.title}

    {/* Notion文章主体 */} {post && (
    diff --git a/themes/heo/components/BlogPostCard.js b/themes/heo/components/BlogPostCard.js index fa16fc25..b07fa06c 100644 --- a/themes/heo/components/BlogPostCard.js +++ b/themes/heo/components/BlogPostCard.js @@ -4,6 +4,7 @@ import TagItemMini from './TagItemMini' import LazyImage from '@/components/LazyImage' import { siteConfig } from '@/lib/config' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' +import NotionIcon from '@/components/NotionIcon' const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { const showPreview = siteConfig('HEO_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap @@ -13,7 +14,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { const showPageCover = siteConfig('HEO_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail && !showPreview const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}` return ( -
    +
    { {/* 文字区块 */}
    -
    +
    {/* 分类 */} {post?.category && +
    {/* 摘要 */} {(!showPreview || showSummary) && ( -

    +

    {post.summary} -

    +
    )}
    @@ -70,7 +71,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
    -
    +
    ) } diff --git a/themes/hexo/components/BlogPostCardInfo.js b/themes/hexo/components/BlogPostCardInfo.js index 890952d5..6ab5eda7 100644 --- a/themes/hexo/components/BlogPostCardInfo.js +++ b/themes/hexo/components/BlogPostCardInfo.js @@ -5,6 +5,7 @@ import TwikooCommentCount from '@/components/TwikooCommentCount' import { siteConfig } from '@/lib/config' import { formatDateFmt } from '@/lib/formatDate' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' +import NotionIcon from '@/components/NotionIcon' /** * 博客列表的文字内容 @@ -13,58 +14,63 @@ import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' */ export const BlogPostCardInfo = ({ post, showPreview, showPageCover, showSummary }) => { const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}` - return
    + return
    - {/* 标题 */} - +
    +

    + {/* 标题 */} + - {post.title} + {post.title} - + +

    - {/* 分类 */} - { post?.category &&
    - + {/* 分类 */} + { post?.category &&
    + - - {post.category} + + {post.category} - + - -
    } + +
    } +
    - {/* 摘要 */} - {(!showPreview || showSummary) && !post.results && ( -

    + {/* 摘要 */} + {(!showPreview || showSummary) && !post.results && ( +

    {post.summary} -

    - )} +
    + )} - {/* 搜索结果 */} - {post.results && ( -

    - {post.results.map((r, index) => ( - {r} - ))} -

    - )} - {/* 预览 */} - {showPreview && ( -
    - -
    - )} + {/* 搜索结果 */} + {post.results && ( +

    + {post.results.map((r, index) => ( + {r} + ))} +

    + )} + + {/* 预览 */} + {showPreview && ( +
    + +
    + )}
    @@ -92,5 +98,5 @@ export const BlogPostCardInfo = ({ post, showPreview, showPageCover, showSummary
    - + } diff --git a/themes/matery/components/BlogPostCard.js b/themes/matery/components/BlogPostCard.js index 7700957d..d66ee6db 100644 --- a/themes/matery/components/BlogPostCard.js +++ b/themes/matery/components/BlogPostCard.js @@ -6,6 +6,7 @@ import TwikooCommentCount from '@/components/TwikooCommentCount' import LazyImage from '@/components/LazyImage' import { formatDateFmt } from '@/lib/formatDate' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' +import NotionIcon from '@/components/NotionIcon' const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { const showPreview = siteConfig('MATERY_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap @@ -27,7 +28,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { className="w-full mb-4 overflow-hidden shadow-md border dark:border-black rounded-xl bg-white dark:bg-hexo-black-gray"> {/* 固定高度 ,空白用图片拉升填充 */} -
    +
    {/* 头部图片 填充卡片 */} {showPageCover && ( @@ -38,13 +39,15 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { alt={post.title} className="h-full w-full group-hover:scale-125 group-hover:brightness-50 brightness-90 rounded-t-md transform object-cover duration-500" /> -
    {post.title}
    +

    + {post.title} +

    )} {/* 文字描述 */} -
    +
    {/* 描述 */}
    @@ -93,8 +96,8 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
    )} - - + + ) diff --git a/themes/matery/components/PostHeader.js b/themes/matery/components/PostHeader.js index 56f8e541..9279b78c 100644 --- a/themes/matery/components/PostHeader.js +++ b/themes/matery/components/PostHeader.js @@ -1,4 +1,5 @@ import LazyImage from '@/components/LazyImage' +import NotionIcon from '@/components/NotionIcon' /** * 文章背景图 @@ -9,7 +10,7 @@ export default function PostHeader({ post, siteInfo }) { return ( )} - + ) } diff --git a/themes/nav/index.js b/themes/nav/index.js index c8006469..1e263050 100755 --- a/themes/nav/index.js +++ b/themes/nav/index.js @@ -33,6 +33,7 @@ import LogoBar from './components/LogoBar' import { siteConfig } from '@/lib/config' import Live2D from '@/components/Live2D' import BlogArchiveItem from './components/BlogArchiveItem' +import NotionIcon from '@/components/NotionIcon' const WWAds = dynamic(() => import('@/components/WWAds'), { ssr: false }) @@ -221,7 +222,7 @@ const LayoutSlug = (props) => { {!lock &&
    {/* title */} -

    {post?.title}

    +

    {post?.title}

    {/* Notion文章主体 */} {post && (
    diff --git a/themes/nobelium/components/ArticleInfo.js b/themes/nobelium/components/ArticleInfo.js index 3e6a6220..b916d8cc 100644 --- a/themes/nobelium/components/ArticleInfo.js +++ b/themes/nobelium/components/ArticleInfo.js @@ -3,6 +3,7 @@ import Image from 'next/image' import TagItem from './TagItem' import md5 from 'js-md5' import { siteConfig } from '@/lib/config' +import NotionIcon from '@/components/NotionIcon' export const ArticleInfo = (props) => { const { post } = props @@ -12,9 +13,9 @@ export const ArticleInfo = (props) => { return
    -
    - {post?.title} -
    +

    + {post?.title} +

    {post?.type !== 'Page' && <>
    + +
    From 77a367d17584a88b71aaaf40282c8a040d160a58 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 5 Feb 2024 18:02:56 +0800 Subject: [PATCH 13/18] =?UTF-8?q?=E4=B8=BB=E9=A2=98=E6=94=AF=E6=8C=81title?= =?UTF-8?q?=20icon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/example/components/Title.js | 1 - themes/gitbook/components/BlogPostCard.js | 5 +++-- themes/gitbook/components/MenuItemDrop.js | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/themes/example/components/Title.js b/themes/example/components/Title.js index 4308611a..73ca9d7f 100644 --- a/themes/example/components/Title.js +++ b/themes/example/components/Title.js @@ -10,7 +10,6 @@ export const Title = (props) => { const { post } = props const title = post?.title || siteConfig('TITLE') const description = post?.description || siteConfig('AUTHOR') - console.log('post', post) return

    {title}

    diff --git a/themes/gitbook/components/BlogPostCard.js b/themes/gitbook/components/BlogPostCard.js index a177b700..891e3ea7 100644 --- a/themes/gitbook/components/BlogPostCard.js +++ b/themes/gitbook/components/BlogPostCard.js @@ -2,6 +2,7 @@ import { siteConfig } from '@/lib/config' import Link from 'next/link' import { useRouter } from 'next/router' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' +import NotionIcon from '@/components/NotionIcon' const BlogPostCard = ({ post, className }) => { const router = useRouter() @@ -9,8 +10,8 @@ const BlogPostCard = ({ post, className }) => { const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}` return (
    -
    - {post.title} +
    + {post.title}
    diff --git a/themes/gitbook/components/MenuItemDrop.js b/themes/gitbook/components/MenuItemDrop.js index 6c197700..572c9b22 100644 --- a/themes/gitbook/components/MenuItemDrop.js +++ b/themes/gitbook/components/MenuItemDrop.js @@ -11,7 +11,6 @@ export const MenuItemDrop = ({ link }) => { } const hasSubMenu = link?.subMenus?.length > 0 const selected = (router.pathname === link.to) || (router.asPath === link.to) - console.log('link', link?.to) return
  • changeShow(true)} onMouseOut={() => changeShow(false)} > {hasSubMenu && From cd1e54688f8a740db0318b061814e415b0a6c249 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 5 Feb 2024 19:10:17 +0800 Subject: [PATCH 14/18] =?UTF-8?q?Landing=E4=B8=BB=E9=A2=98=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.js | 13 ++--- themes/landing/components/Features.js | 10 ++-- themes/landing/components/FeaturesBlocks.js | 18 +++---- themes/landing/components/Header.js | 4 +- themes/landing/components/Hero.js | 2 +- themes/landing/components/Pricing.js | 56 +++++++++++++++++++++ themes/landing/components/Testimonials.js | 4 +- themes/landing/config.js | 23 ++++++++- themes/landing/index.js | 8 +-- 9 files changed, 109 insertions(+), 29 deletions(-) create mode 100644 themes/landing/components/Pricing.js diff --git a/next.config.js b/next.config.js index d0e32e96..13025163 100644 --- a/next.config.js +++ b/next.config.js @@ -16,13 +16,14 @@ function scanSubdirectories(directory) { const subdirectories = [] fs.readdirSync(directory).forEach(file => { - const fullPath = path.join(directory, file) - const stats = fs.statSync(fullPath) + // 这段代码会将landing排除在可选主题中 - // landing主题比较特殊,不在可切换的主题中显示 - if (stats.isDirectory() && file !== 'landing') { - subdirectories.push(file) - } + // const fullPath = path.join(directory, file) + // const stats = fs.statSync(fullPath) + // landing主题默认隐藏掉,一般网站不会用到 + // if (stats.isDirectory() && file !== 'landing') { + // subdirectories.push(file) + // } }) return subdirectories diff --git a/themes/landing/components/Features.js b/themes/landing/components/Features.js index c0e403b5..c576fd3a 100644 --- a/themes/landing/components/Features.js +++ b/themes/landing/components/Features.js @@ -25,7 +25,7 @@ export default function Features() {
    {/* Section background (needs .relative class on parent and next sibling elements) */} - +
    @@ -33,8 +33,8 @@ export default function Features() { {/* Section header */}
    -

    {siteConfig('LANDING_FEATURES_HEADER_1', null, CONFIG)}

    -

    +

    {siteConfig('LANDING_FEATURES_HEADER_1', null, CONFIG)}

    +

    {/* Section content */} @@ -43,8 +43,8 @@ export default function Features() { {/* Content */}
    -

    {siteConfig('LANDING_FEATURES_HEADER_2', null, CONFIG)}

    -

    {siteConfig('LANDING_FEATURES_HEADER_2_P', null, CONFIG)}

    +

    {siteConfig('LANDING_FEATURES_HEADER_2', null, CONFIG)}

    +

    {siteConfig('LANDING_FEATURES_HEADER_2_P', null, CONFIG)}

    {/* Tabs buttons */}
    diff --git a/themes/landing/components/FeaturesBlocks.js b/themes/landing/components/FeaturesBlocks.js index 07e63e50..fd3068b6 100644 --- a/themes/landing/components/FeaturesBlocks.js +++ b/themes/landing/components/FeaturesBlocks.js @@ -6,7 +6,7 @@ export default function FeaturesBlocks() {
    {/* Section background (needs .relative class on parent and next sibling elements) */} - +
    @@ -14,15 +14,15 @@ export default function FeaturesBlocks() { {/* Section header */}
    -

    {siteConfig('LANDING_FEATURES_BLOCK_HEADER', null, CONFIG)}

    -

    +

    {siteConfig('LANDING_FEATURES_BLOCK_HEADER', null, CONFIG)}

    +

    {/* Items */}
    {/* 1st item */} -
    +
    @@ -39,7 +39,7 @@ export default function FeaturesBlocks() {
    {/* 2nd item */} -
    +
    @@ -55,7 +55,7 @@ export default function FeaturesBlocks() {
    {/* 3rd item */} -
    +
    @@ -72,7 +72,7 @@ export default function FeaturesBlocks() {
    {/* 4th item */} -
    +
    @@ -89,7 +89,7 @@ export default function FeaturesBlocks() {
    {/* 5th item */} -
    +
    @@ -105,7 +105,7 @@ export default function FeaturesBlocks() {
    {/* 6th item */} -
    +
    diff --git a/themes/landing/components/Header.js b/themes/landing/components/Header.js index 2b0540ff..2b71d944 100644 --- a/themes/landing/components/Header.js +++ b/themes/landing/components/Header.js @@ -22,7 +22,7 @@ export default function Header() { }, [top]) return ( -
    +
    @@ -36,7 +36,7 @@ export default function Header() { {/* Desktop sign in links */}