diff --git a/blog.config.js b/blog.config.js index 7c0358d3..39e8336b 100644 --- a/blog.config.js +++ b/blog.config.js @@ -398,6 +398,7 @@ const BLOG = { IMG_LAZY_LOAD_PLACEHOLDER: process.env.NEXT_PUBLIC_IMG_LAZY_LOAD_PLACEHOLDER || 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', // 懒加载占位图片地址,支持base64或url IMG_URL_TYPE: process.env.NEXT_PUBLIC_IMG_TYPE || 'Notion', // 此配置已失效,请勿使用;AMAZON方案不再支持,仅支持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, // 文章图片是否自动添加阴影 + IMG_COMPRESS_WIDTH: process.env.NEXT_PUBLIC_IMG_COMPRESS_WIDTH || 800, // Notion图片压缩宽度 // 开发相关 NOTION_ACCESS_TOKEN: process.env.NOTION_ACCESS_TOKEN || '', // Useful if you prefer not to make your database public diff --git a/themes/simple/components/BlogItem.js b/themes/simple/components/BlogItem.js index 2fb2d7ae..8d682e11 100644 --- a/themes/simple/components/BlogItem.js +++ b/themes/simple/components/BlogItem.js @@ -3,43 +3,60 @@ import CONFIG from '../config' import TwikooCommentCount from '@/components/TwikooCommentCount' import { formatDateFmt } from '@/lib/formatDate' import { siteConfig } from '@/lib/config' +import LazyImage from '@/components/LazyImage' export const BlogItem = props => { const { post } = props + const showPageCover = siteConfig('SIMPLE_POST_COVER_ENABLE', false, CONFIG) return
{/* 文章标题 */} -

- - {post.title} - -

+
+
+ {/* 图片封面 */} + {showPageCover && ( +
+ + + +
+ )} +
- {/* 文章信息 */} - -
-
- {siteConfig('AUTHOR')} - - - {post.date?.start_date || post.createdTime} +
+

+ + {post.title} - - -

+ -
- {post.category && {post.category}} - {post?.tags && post?.tags?.length > 0 && post?.tags.map(t => /{t})} -
-
+ {/* 文章信息 */} -
- {post.summary} - {post.summary && ...} +
+
+ {siteConfig('AUTHOR')} + + + {post.date?.start_date || post.createdTime} + + + +
+ +
+ {post.category && {post.category}} + {post?.tags && post?.tags?.length > 0 && post?.tags.map(t => /{t})} +
+
+ +
+ {post.summary} + {post.summary && ...} +
+
diff --git a/themes/simple/components/Header.js b/themes/simple/components/Header.js index a5bc8988..59715c19 100644 --- a/themes/simple/components/Header.js +++ b/themes/simple/components/Header.js @@ -3,6 +3,7 @@ import Link from 'next/link' import CONFIG from '../config' import SocialButton from './SocialButton' import { siteConfig } from '@/lib/config' +import { compressImage } from '@/lib/notion/mapImage' /** * 网站顶部 @@ -10,7 +11,7 @@ import { siteConfig } from '@/lib/config' */ export const Header = (props) => { const { siteInfo } = props - const avatar = siteInfo?.icon || siteConfig('AVATAR') + const avatar = compressImage(siteInfo?.icon || siteConfig('AVATAR'), 200) return (
@@ -18,8 +19,8 @@ export const Header = (props) => { {/* 可使用一张单图作为logo */}
-
- +
+
diff --git a/themes/simple/components/MenuList.js b/themes/simple/components/MenuList.js index 13dfe9a5..ec9700bf 100644 --- a/themes/simple/components/MenuList.js +++ b/themes/simple/components/MenuList.js @@ -51,7 +51,7 @@ export const MenuList = ({ customNav, customMenu }) => { return (<> {/* 大屏模式菜单 */} {/* 移动端小屏菜单 */} diff --git a/themes/simple/components/SocialButton.js b/themes/simple/components/SocialButton.js index 0e2b9065..b9def55b 100644 --- a/themes/simple/components/SocialButton.js +++ b/themes/simple/components/SocialButton.js @@ -6,8 +6,8 @@ import { siteConfig } from '@/lib/config' * @constructor */ const SocialButton = () => { - return
-
+ return
+
{siteConfig('CONTACT_GITHUB') && } diff --git a/themes/simple/config.js b/themes/simple/config.js index 18ebc783..c7cdf991 100644 --- a/themes/simple/config.js +++ b/themes/simple/config.js @@ -9,10 +9,12 @@ const CONFIG = { SIMPLE_POST_AD_ENABLE: process.env.NEXT_PUBLIC_SIMPLE_POST_AD_ENABLE || false, // 文章列表是否插入广告 + SIMPLE_POST_COVER_ENABLE: process.env.NEXT_PUBLIC_SIMPLE_POST_COVER_ENABLE || false, // 是否展示博客封面 + // 菜单配置 SIMPLE_MENU_CATEGORY: true, // 显示分类 SIMPLE_MENU_TAG: true, // 显示标签 SIMPLE_MENU_ARCHIVE: true, // 显示归档 SIMPLE_MENU_SEARCH: true // 显示搜索 } -export default CONFIG +export default CO \ No newline at end of file