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..66fe457c 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', 'css') + } + 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/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], 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/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 { diff --git a/themes/hexo/components/BlogPostCard.js b/themes/hexo/components/BlogPostCard.js index eeb6e0b2..1f02e323 100644 --- a/themes/hexo/components/BlogPostCard.js +++ b/themes/hexo/components/BlogPostCard.js @@ -11,39 +11,30 @@ 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 (
+ {/* 摘要 */} + {(!showPreview || showSummary) && !post.results && ( +
{post.summary}
- )} + )} {/* 搜索结果 */} {post.results && ( @@ -55,8 +70,11 @@ export const BlogPostCardInfo = ({ post, showPreview, showSummary }) => {