Skip to content

Commit

Permalink
Merge pull request #3121 from tangly1024/release/4.8.1
Browse files Browse the repository at this point in the history
Release/4.8.1
  • Loading branch information
tangly1024 authored Jan 5, 2025
2 parents bb612de + 2ea797f commit 30d8e76
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion blog.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const BLOG = {
// 原配置文件过长,且并非所有人都会用到,故此将配置拆分到/conf/目录下, 按需找到对应文件并修改即可
...require('./conf/comment.config'), // 评论插件
...require('./conf/contact.config'), // 作者联系方式配置
...require('./conf/post.config'), // 文章与列表配置
...require('./conf/analytics.config'), // 站点访问统计
...require('./conf/post.config'), // 博客列表数量、文章url相关配置
...require('./conf/image.config'), // 网站图片相关配置
...require('./conf/font.config'), // 网站字体
...require('./conf/right-click-menu'), // 自定义右键菜单相关配置
Expand Down
5 changes: 4 additions & 1 deletion conf/post.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* 博客列表相关配置
* 文章相关功能
*/
module.exports = {
// 文章URL前缀
Expand All @@ -9,6 +9,9 @@ module.exports = {
// 支援類似 WP 可自訂文章連結格式的功能:https://wordpress.org/documentation/article/customize-permalinks/,目前只先實作 %year%/%month%/%day%
// 例:如想連結改成前綴 article + 時間戳記,可變更為: 'article/%year%/%month%/%day%'

POST_SCHEDULE_PUBLISH:
process.env.NEXT_PUBLIC_NOTION_SCHEDULE_PUBLISH || true, // 按照文章的发布时间字段,控制自动上下架

// 分享条
POST_SHARE_BAR_ENABLE: process.env.NEXT_PUBLIC_POST_SHARE_BAR || 'true', //文章底部分享条开关
POSTS_SHARE_SERVICES:
Expand Down
1 change: 1 addition & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const siteConfig = (key, defaultVal = null, extendConfig = {}) => {
case 'POST_LIST_STYLE':
case 'POST_LIST_PREVIEW':
case 'POST_URL_PREFIX_MAPPING_CATEGORY':
case 'POST_SCHEDULE_PUBLISH':
case 'IS_TAG_COLOR_DISTINGUISHED':
case 'TAG_SORT_BY_COUNT':
case 'THEME':
Expand Down
2 changes: 1 addition & 1 deletion lib/db/getSiteData.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ async function convertNotionToSiteDate(pageId, from, pageRecordMap) {

// 新特性,判断文章的发布和下架时间,如果不在有效期内则进行下架处理
const publish = isInRange(post.date)
if (!publish) {
if (!publish && siteConfig('POST_SCHEDULE_PUBLISH', '', NOTION_CONFIG)) {
console.log(post.title, '未处于发布时段 [', post.date, '] 内,将强制隐藏')
// 隐藏
post.status = 'Invisible'
Expand Down

0 comments on commit 30d8e76

Please sign in to comment.