From 58c0cc2837e2be6f0cb3069bb02e692cacfb0e54 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Sun, 9 Jul 2023 17:15:56 +0800 Subject: [PATCH] fukasawa-seo --- components/Collapse.js | 2 +- lib/notion/mapImage.js | 2 +- package.json | 1 - pages/_app.js | 8 +------- themes/fukasawa/components/ArticleLock.js | 4 +++- themes/fukasawa/components/AsideLeft.js | 2 +- themes/fukasawa/components/BlogCard.js | 6 +++--- themes/fukasawa/components/GroupTag.js | 2 +- themes/fukasawa/components/MenuList.js | 8 ++++---- themes/fukasawa/components/SearchInput.js | 4 ++++ themes/fukasawa/components/SiteInfo.js | 6 +++--- themes/fukasawa/components/SocialButton.js | 2 +- themes/fukasawa/index.js | 8 +++++--- 13 files changed, 28 insertions(+), 27 deletions(-) diff --git a/components/Collapse.js b/components/Collapse.js index d9942968..25db6292 100644 --- a/components/Collapse.js +++ b/components/Collapse.js @@ -84,7 +84,7 @@ const Collapse = props => { }, [props.isOpen]) return ( -
+
{props.children}
) diff --git a/lib/notion/mapImage.js b/lib/notion/mapImage.js index 0d8a7ca0..2e917b93 100644 --- a/lib/notion/mapImage.js +++ b/lib/notion/mapImage.js @@ -6,7 +6,7 @@ import BLOG from '@/blog.config' * 2. UnPlash 图片可以通过api q=50 控制压缩质量 width=400 控制图片尺寸 * @param {*} image */ -const compressImage = (image, width = 400) => { +const compressImage = (image, width = 300) => { if (!image) { return null } diff --git a/package.json b/package.json index e9e82e1e..4dc4f749 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,6 @@ "react-notion-x": "6.16.0", "react-share": "^4.4.1", "react-tweet-embed": "~2.0.0", - "smoothscroll-polyfill": "^0.4.4", "typed.js": "^2.0.12", "use-ackee": "^3.0.0" }, diff --git a/pages/_app.js b/pages/_app.js index f007ac17..e0d11382 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -1,6 +1,6 @@ import { useEffect } from 'react' -import 'animate.css' +// import 'animate.css' import '@/styles/globals.css' import '@/styles/nprogress.css' import '@/styles/utility-patterns.css' @@ -11,11 +11,8 @@ import '@/styles/notion.css' // 重写部分样式 import { GlobalContextProvider } from '@/lib/global' -import { isMobile } from '@/lib/utils' import AOS from 'aos' import 'aos/dist/aos.css' // You can also use for styles - -import smoothscroll from 'smoothscroll-polyfill' import dynamic from 'next/dynamic' // 自定义样式css和js引入 @@ -27,9 +24,6 @@ const ExternalPlugins = dynamic(() => import('@/components/ExternalPlugins')) const MyApp = ({ Component, pageProps }) => { useEffect(() => { AOS.init() - if (isMobile()) { - smoothscroll.polyfill() - } }, []) return ( diff --git a/themes/fukasawa/components/ArticleLock.js b/themes/fukasawa/components/ArticleLock.js index 293c308d..77ec5659 100644 --- a/themes/fukasawa/components/ArticleLock.js +++ b/themes/fukasawa/components/ArticleLock.js @@ -8,7 +8,7 @@ import { useEffect, useRef } from 'react' * @param validPassword(bool) 回调函数,校验正确回调入参为true * @returns */ -export const ArticleLock = props => { +const ArticleLock = props => { const { validPassword } = props const { locale } = useGlobal() @@ -58,3 +58,5 @@ export const ArticleLock = props => {
) } + +export default ArticleLock diff --git a/themes/fukasawa/components/AsideLeft.js b/themes/fukasawa/components/AsideLeft.js index b2556556..ba05d899 100644 --- a/themes/fukasawa/components/AsideLeft.js +++ b/themes/fukasawa/components/AsideLeft.js @@ -59,7 +59,7 @@ function AsideLeft(props) { {isCollapsed ? : } } -
+
diff --git a/themes/fukasawa/components/BlogCard.js b/themes/fukasawa/components/BlogCard.js index 1513b6d0..e60303c2 100644 --- a/themes/fukasawa/components/BlogCard.js +++ b/themes/fukasawa/components/BlogCard.js @@ -28,7 +28,7 @@ const BlogCard = ({ index, post, showSummary, siteInfo }) => { {/* eslint-disable-next-line @next/next/no-img-element */} {post.title} @@ -44,13 +44,13 @@ const BlogCard = ({ index, post, showSummary, siteInfo }) => { {(!showPreview || showSummary) && ( -

+

{post.summary}

)} {/* 分类标签 */} -
+
{post.category && { - tags.map(tag => { + tags?.slice(0, 20)?.map(tag => { const selected = tag.name === currentTag return }) diff --git a/themes/fukasawa/components/MenuList.js b/themes/fukasawa/components/MenuList.js index d65e268d..6adc3a76 100644 --- a/themes/fukasawa/components/MenuList.js +++ b/themes/fukasawa/components/MenuList.js @@ -30,12 +30,12 @@ export const MenuList = (props) => { } return (<> - - + ) diff --git a/themes/fukasawa/components/SearchInput.js b/themes/fukasawa/components/SearchInput.js index a74ece78..ba918f56 100644 --- a/themes/fukasawa/components/SearchInput.js +++ b/themes/fukasawa/components/SearchInput.js @@ -1,9 +1,11 @@ +import { useGlobal } from '@/lib/global' import { useRouter } from 'next/router' import { useImperativeHandle, useRef, useState } from 'react' const SearchInput = (props) => { const { keyword, cRef } = props const [onLoading, setLoadingState] = useState(false) + const { locale } = useGlobal() const router = useRouter() const searchInputRef = useRef() useImperativeHandle(cRef, () => { @@ -54,6 +56,8 @@ const SearchInput = (props) => { - © {`${copyrightDate}`} {BLOG.AUTHOR}.
+ © {`${copyrightDate}`} {BLOG.AUTHOR}.
{BLOG.BEI_AN && <> {BLOG.BEI_AN}
}
- Powered by NotionNext {BLOG.VERSION}
+ Powered by NotionNext {BLOG.VERSION}

{title}

) diff --git a/themes/fukasawa/components/SocialButton.js b/themes/fukasawa/components/SocialButton.js index 9bde6289..e3d39317 100644 --- a/themes/fukasawa/components/SocialButton.js +++ b/themes/fukasawa/components/SocialButton.js @@ -8,7 +8,7 @@ import React from 'react' */ const SocialButton = () => { return
-
+
{BLOG.CONTACT_GITHUB && } diff --git a/themes/fukasawa/index.js b/themes/fukasawa/index.js index 341e9e31..ff1237d5 100644 --- a/themes/fukasawa/index.js +++ b/themes/fukasawa/index.js @@ -4,7 +4,6 @@ import CONFIG from './config' import CommonHead from '@/components/CommonHead' import TopNav from './components/TopNav' import AsideLeft from './components/AsideLeft' -import Live2D from '@/components/Live2D' import BLOG from '@/blog.config' import { isBrowser, loadExternalResource } from '@/lib/utils' import { useGlobal } from '@/lib/global' @@ -12,13 +11,16 @@ import BlogListPage from './components/BlogListPage' import BlogListScroll from './components/BlogListScroll' import BlogArchiveItem from './components/BlogPostArchive' import ArticleDetail from './components/ArticleDetail' -import { ArticleLock } from './components/ArticleLock' +import ArticleLock from './components/ArticleLock' import TagItemMini from './components/TagItemMini' import { useRouter } from 'next/router' import { createContext, useContext, useEffect, useState } from 'react' -import Mark from 'mark.js' import Link from 'next/link' import { Transition } from '@headlessui/react' +import dynamic from 'next/dynamic' + +const Live2D = dynamic(() => import('@/components/Live2D')) +const Mark = dynamic(() => import('mark.js')) // 主题全局状态 const ThemeGlobalFukasawa = createContext()