From 5fe62df504ee1bce4dff8980a0306bb19bbe4eef Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Mon, 13 Mar 2023 21:02:35 +0800 Subject: [PATCH 1/8] =?UTF-8?q?hexo=20=E5=B0=81=E9=9D=A2=E5=9B=BE=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/hexo/components/BlogPostCard.js | 14 ++++++++------ themes/hexo/components/BlogPostCardInfo.js | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/themes/hexo/components/BlogPostCard.js b/themes/hexo/components/BlogPostCard.js index eeb6e0b2..85041c67 100644 --- a/themes/hexo/components/BlogPostCard.js +++ b/themes/hexo/components/BlogPostCard.js @@ -17,7 +17,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
{/* 文字内容 */} @@ -27,7 +27,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { data-aos-delay={delay} data-aos-once="true" data-aos-anchor-placement="top-bottom" - className={`flex flex-col lg:p-6 p-4 ${showPageCover ? 'md:w-7/12 w-full ' : 'w-full'}`}> + className={`flex flex-col justify-start lg:p-6 p-4 md:max-h-60 ${showPageCover ? 'md:w-7/12 w-full ' : 'w-full'}`}> @@ -35,15 +35,17 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { {/* 图片封面 */} {showPageCover && !showPreview && post?.page_cover && ( -
+
{/* eslint-disable-next-line @next/next/no-img-element */} - {post.title} + className="w-full relative cursor-pointer object-cover duration-200 hover:scale-125 " + /> */} +
+ {/*
{ {/* 摘要 */} {(!showPreview || showSummary) && !post.results && ( -

+

{post.summary}

)} From 809c31f7928b00aa185ce1527680c16e40362814 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Mon, 13 Mar 2023 21:14:35 +0800 Subject: [PATCH 2/8] sitemap --- pages/sitemap.xml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/sitemap.xml.js b/pages/sitemap.xml.js index b17b3e45..8f753f5d 100644 --- a/pages/sitemap.xml.js +++ b/pages/sitemap.xml.js @@ -38,7 +38,7 @@ export const getServerSideProps = async (ctx) => { priority: '0.7' } ] - const postFields = allPages?.map(post => { + const postFields = allPages?.filter(p => p.status === BLOG.NOTION_PROPERTY_NAME.status_publish)?.map(post => { return { loc: `${BLOG.LINK}/${post.slug}`, lastmod: new Date(post?.date?.start_date || post?.createdTime).toISOString().split('T')[0], From 698ff97977f9557cfba0fd4acc17e15b97d938be Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Tue, 14 Mar 2023 13:43:48 +0800 Subject: [PATCH 3/8] table-scroll --- styles/notion.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/styles/notion.css b/styles/notion.css index e6e1e596..8b2b19ef 100644 --- a/styles/notion.css +++ b/styles/notion.css @@ -180,7 +180,7 @@ } .notion-simple-table { - @apply whitespace-nowrap overflow-x-scroll block + @apply whitespace-nowrap overflow-x-auto block } .notion-app { From ab5f809650e65381878546a789729aaee5eab456 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Tue, 14 Mar 2023 14:58:58 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=B0=81=E9=9D=A2=E5=9B=BEhexo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/hexo/components/BlogPostCard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/hexo/components/BlogPostCard.js b/themes/hexo/components/BlogPostCard.js index 85041c67..1d1ed14e 100644 --- a/themes/hexo/components/BlogPostCard.js +++ b/themes/hexo/components/BlogPostCard.js @@ -44,7 +44,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { loading='lazy' className="w-full relative cursor-pointer object-cover duration-200 hover:scale-125 " /> */} -
+
{/*
Date: Tue, 14 Mar 2023 15:12:56 +0800 Subject: [PATCH 5/8] =?UTF-8?q?hexo=20-=20=E8=83=8C=E6=99=AF=E5=9B=BE?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/hexo/components/Header.js | 2 +- themes/hexo/config_hexo.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/hexo/components/Header.js b/themes/hexo/components/Header.js index c15153f3..87e83e10 100644 --- a/themes/hexo/components/Header.js +++ b/themes/hexo/components/Header.js @@ -87,7 +87,7 @@ const Header = props => { id="header" className="w-full h-screen bg-black text-white relative" > -
+
{/* Date: Tue, 14 Mar 2023 15:40:21 +0800 Subject: [PATCH 6/8] blog-card-height --- themes/hexo/components/BlogPostCard.js | 13 +------- themes/hexo/components/BlogPostCardInfo.js | 39 ++++++++++++++++------ 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/themes/hexo/components/BlogPostCard.js b/themes/hexo/components/BlogPostCard.js index 1d1ed14e..1f02e323 100644 --- a/themes/hexo/components/BlogPostCard.js +++ b/themes/hexo/components/BlogPostCard.js @@ -11,7 +11,6 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { post.page_cover = siteInfo?.pageCover } const showPageCover = CONFIG_HEXO.POST_LIST_COVER && post?.page_cover - const delay = (index % 2) * 200 return (
{ border dark:border-black rounded-xl bg-white dark:bg-hexo-black-gray`}> {/* 文字内容 */} -
- - - -
+ {/* 图片封面 */} {showPageCover && !showPreview && post?.page_cover && ( diff --git a/themes/hexo/components/BlogPostCardInfo.js b/themes/hexo/components/BlogPostCardInfo.js index 8c99dc93..68dc911d 100644 --- a/themes/hexo/components/BlogPostCardInfo.js +++ b/themes/hexo/components/BlogPostCardInfo.js @@ -3,10 +3,25 @@ import NotionPage from '@/components/NotionPage' import Link from 'next/link' import TagItemMini from './TagItemMini' -export const BlogPostCardInfo = ({ post, showPreview, showSummary }) => { - return <> - {/* 标题 */} - { + const delay = (index % 2) * 200 + + return
+
+ + {/* 标题 */} + {
- {/* 摘要 */} - {(!showPreview || showSummary) && !post.results && ( + {/* 摘要 */} + {(!showPreview || showSummary) && !post.results && (

{post.summary}

- )} + )} {/* 搜索结果 */} {post.results && ( @@ -55,8 +70,11 @@ export const BlogPostCardInfo = ({ post, showPreview, showSummary }) => {
)} - {/* 分类标签 */} -
+
+ +
+ {/* 分类标签 */} +
{
- +
+
} From 531aa2f0900af3c0d47dc2d04faa86f92b71aaee Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Tue, 14 Mar 2023 19:32:54 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=9B=BE=E7=89=87=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=98=B4=E5=BD=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blog.config.js | 3 ++- components/ExternalScript.js | 6 ++++++ pages/[...slug].js | 2 +- public/avatar.svg | 11 +++++++++++ public/css/img-shadow.css | 4 ++++ themes/simple/components/Header.js | 3 ++- 6 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 public/avatar.svg create mode 100644 public/css/img-shadow.css diff --git a/blog.config.js b/blog.config.js index 14dcc2da..79c15edb 100644 --- a/blog.config.js +++ b/blog.config.js @@ -218,13 +218,14 @@ const BLOG = { ENABLE_RSS: process.env.NEXT_PUBLIC_ENABLE_RSS || true, // 是否开启RSS订阅功能 // 作废配置 - AVATAR: process.env.NEXT_PUBLIC_AVATAR || '/avatar.png', // 作者头像,被notion中的ICON覆盖。若无ICON则取public目录下的avatar.png + AVATAR: process.env.NEXT_PUBLIC_AVATAR || '/avatar.svg', // 作者头像,被notion中的ICON覆盖。若无ICON则取public目录下的avatar.png TITLE: process.env.NEXT_PUBLIC_TITLE || 'NotionNext BLOG', // 站点标题 ,被notion中的页面标题覆盖 HOME_BANNER_IMAGE: process.env.NEXT_PUBLIC_HOME_BANNER_IMAGE || './bg_image.jpg', // 首页背景大图, 会被notion中的封面图覆盖,若无封面图则会使用代码中的 /public/bg_image.jpg 文件 DESCRIPTION: process.env.NEXT_PUBLIC_DESCRIPTION || '这是一个由NotionNext生成的站点', // 站点描述,被notion中的页面描述覆盖 // 网站图片 IMG_URL_TYPE: process.env.NEXT_PUBLIC_IMG_TYPE || 'Notion', // ['Notion','AMAZON'] 站点图片前缀 默认 Notion:(https://notion.so/images/xx) , AMAZON(https://s3.us-west-2.amazonaws.com/xxx) + IMG_SHADOW: process.env.NEXT_PUBLIC_IMG_SHADOW || false, // 文章图片是否自动添加阴影 // 开发相关 NOTION_ACCESS_TOKEN: process.env.NOTION_ACCESS_TOKEN || '', // Useful if you prefer not to make your database public diff --git a/components/ExternalScript.js b/components/ExternalScript.js index f1672b16..a01735c0 100644 --- a/components/ExternalScript.js +++ b/components/ExternalScript.js @@ -12,6 +12,12 @@ const ExternalScript = () => { loadExternalResource(BLOG.FONT_AWESOME, 'css') loadExternalResource('/css/custom.css', 'css') loadExternalResource('/js/custom.js', 'js') + + // 自动添加图片阴影 + if (BLOG.IMG_SHADOW) { + loadExternalResource('/css/img-shadow.css', 'js') + } + if (BLOG.CUSTOM_EXTERNAL_JS && BLOG.CUSTOM_EXTERNAL_JS.length > 0) { for (const url of BLOG.CUSTOM_EXTERNAL_JS) { loadExternalResource(url, 'js') diff --git a/pages/[...slug].js b/pages/[...slug].js index d891ce06..e14b98a2 100644 --- a/pages/[...slug].js +++ b/pages/[...slug].js @@ -100,7 +100,7 @@ export async function getStaticPaths() { const from = 'slug-paths' const { allPages } = await getGlobalNotionData({ from }) return { - paths: allPages.map(row => ({ params: { slug: [row.slug] } })), + paths: allPages?.map(row => ({ params: { slug: [row.slug] } })), fallback: true } } diff --git a/public/avatar.svg b/public/avatar.svg new file mode 100644 index 00000000..31a1446c --- /dev/null +++ b/public/avatar.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/public/css/img-shadow.css b/public/css/img-shadow.css new file mode 100644 index 00000000..ab674c1e --- /dev/null +++ b/public/css/img-shadow.css @@ -0,0 +1,4 @@ +/* 图片阴影 */ +#notion-article img{ + box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px; +} diff --git a/themes/simple/components/Header.js b/themes/simple/components/Header.js index 2f6dc105..89b9a602 100644 --- a/themes/simple/components/Header.js +++ b/themes/simple/components/Header.js @@ -9,6 +9,7 @@ import CONFIG_SIMPLE from '../config_simple' */ export const Header = (props) => { const { siteInfo } = props + const avatar = siteInfo?.icon || BLOG.AVATAR return (
@@ -20,7 +21,7 @@ export const Header = (props) => {
{/* eslint-disable-next-line @next/next/no-img-element */} - {BLOG.AUTHOR} + {BLOG.AUTHOR}
From 7c4ff169142e2298adf7f4a6f7e824fcd09af66d Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Tue, 14 Mar 2023 19:40:34 +0800 Subject: [PATCH 8/8] build --- components/ExternalScript.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/ExternalScript.js b/components/ExternalScript.js index a01735c0..66fe457c 100644 --- a/components/ExternalScript.js +++ b/components/ExternalScript.js @@ -15,7 +15,7 @@ const ExternalScript = () => { // 自动添加图片阴影 if (BLOG.IMG_SHADOW) { - loadExternalResource('/css/img-shadow.css', 'js') + loadExternalResource('/css/img-shadow.css', 'css') } if (BLOG.CUSTOM_EXTERNAL_JS && BLOG.CUSTOM_EXTERNAL_JS.length > 0) {