diff --git a/blog.config.js b/blog.config.js index 76ab5d35..3dbd6a1d 100644 --- a/blog.config.js +++ b/blog.config.js @@ -22,7 +22,7 @@ const BLOG = { PATH: '', // leave this empty unless you want to deploy in a folder POST_LIST_STYLE: 'page', // ['page','scroll] 文章列表样式:页码分页、单页滚动加载 - POST_LIST_PREVIEW: false, // 是否在列表加载文章预览 + POST_LIST_PREVIEW: process.env.NEXT_PUBLIC_POST_PREVIEW || 'false', // 是否在列表加载文章预览 POST_PREVIEW_LINES: 12, // 预览博客行数 POSTS_PER_PAGE: 6, // post counts per page POSTS_SORT_BY: 'notion', // 排序方式 'date'按时间,'notion'由notion控制 diff --git a/pages/index.js b/pages/index.js index 02a15885..8691c8ee 100644 --- a/pages/index.js +++ b/pages/index.js @@ -28,7 +28,7 @@ export async function getStaticProps () { BLOG.POSTS_PER_PAGE * (page - 1), BLOG.POSTS_PER_PAGE * page ) - if (BLOG.POST_LIST_PREVIEW) { + if (BLOG.POST_LIST_PREVIEW === 'true') { for (const i in postsToShow) { const post = postsToShow[i] const blockMap = await getPostBlocks(post.id, 'slug', BLOG.POST_PREVIEW_LINES) diff --git a/pages/page/[page].js b/pages/page/[page].js index 0149f12d..0c3d62e5 100644 --- a/pages/page/[page].js +++ b/pages/page/[page].js @@ -45,7 +45,7 @@ export async function getStaticProps ({ params: { page } }) { BLOG.POSTS_PER_PAGE * (page - 1), BLOG.POSTS_PER_PAGE * page ) - if (BLOG.POST_LIST_PREVIEW) { + if (BLOG.POST_LIST_PREVIEW === 'true') { for (const i in postsToShow) { const post = postsToShow[i] const blockMap = await getPostBlocks(post.id, 'slug', BLOG.POST_PREVIEW_LINES)