mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-03 15:10:19 +00:00
Merge branch 'tangly1024:main' into main
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables
|
# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables
|
||||||
NEXT_PUBLIC_VERSION=3.12.3
|
NEXT_PUBLIC_VERSION=3.12.4
|
||||||
|
|||||||
@@ -67,8 +67,11 @@ const BLOG = {
|
|||||||
BACKGROUND_DARK: '#000000', // use hex value, don't forget '#'
|
BACKGROUND_DARK: '#000000', // use hex value, don't forget '#'
|
||||||
SUB_PATH: '', // leave this empty unless you want to deploy in a folder
|
SUB_PATH: '', // leave this empty unless you want to deploy in a folder
|
||||||
|
|
||||||
POST_URL_PREFIX: process.env.NEXT_PUBLIC_POST_URL_PREFIX || 'article', // POST类型文章的默认路径前缀,例如默认POST类型的路径是 /article/[slug]
|
POST_URL_PREFIX: process.env.NEXT_PUBLIC_POST_URL_PREFIX || 'article',
|
||||||
|
// POST类型文章的默认路径前缀,例如默认POST类型的路径是 /article/[slug]
|
||||||
// 如果此项配置为 '' 空, 则文章将没有前缀路径,使用场景: 希望文章前缀路径为 /post 的情况 支持多级
|
// 如果此项配置为 '' 空, 则文章将没有前缀路径,使用场景: 希望文章前缀路径为 /post 的情况 支持多级
|
||||||
|
// 支援類似 WP 可自訂文章連結格式的功能:https://wordpress.org/documentation/article/customize-permalinks/,目前只先實作 %year%/%month%/%day%
|
||||||
|
// 例:如想連結改成前綴 article + 時間戳記,可變更為: 'article/%year%/%month%/%day%'
|
||||||
|
|
||||||
POST_LIST_STYLE: process.env.NEXT_PUBLIC_PPOST_LIST_STYLE || 'page', // ['page','scroll] 文章列表样式:页码分页、单页滚动加载
|
POST_LIST_STYLE: process.env.NEXT_PUBLIC_PPOST_LIST_STYLE || 'page', // ['page','scroll] 文章列表样式:页码分页、单页滚动加载
|
||||||
POST_LIST_PREVIEW: process.env.NEXT_PUBLIC_POST_PREVIEW || 'false', // 是否在列表加载文章预览
|
POST_LIST_PREVIEW: process.env.NEXT_PUBLIC_POST_PREVIEW || 'false', // 是否在列表加载文章预览
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export default async function getPageProperties(id, block, schema, authToken, ta
|
|||||||
mapProperties(properties)
|
mapProperties(properties)
|
||||||
|
|
||||||
if (properties.type === BLOG.NOTION_PROPERTY_NAME.type_post) {
|
if (properties.type === BLOG.NOTION_PROPERTY_NAME.type_post) {
|
||||||
properties.slug = BLOG.POST_URL_PREFIX ? (BLOG.POST_URL_PREFIX + '/' + (properties.slug ?? properties.id)) : (properties.slug ?? properties.id)
|
properties.slug = (BLOG.POST_URL_PREFIX) ? generateCustomizeUrl(properties) : (properties.slug ?? properties.id)
|
||||||
} else if (properties.type === BLOG.NOTION_PROPERTY_NAME.type_page) {
|
} else if (properties.type === BLOG.NOTION_PROPERTY_NAME.type_page) {
|
||||||
properties.slug = properties.slug ?? properties.id
|
properties.slug = properties.slug ?? properties.id
|
||||||
} else if (properties.type === BLOG.NOTION_PROPERTY_NAME.type_menu || properties.type === BLOG.NOTION_PROPERTY_NAME.type_sub_menu) {
|
} else if (properties.type === BLOG.NOTION_PROPERTY_NAME.type_menu || properties.type === BLOG.NOTION_PROPERTY_NAME.type_sub_menu) {
|
||||||
@@ -147,3 +147,30 @@ function mapProperties(properties) {
|
|||||||
properties.status = 'Invisible'
|
properties.status = 'Invisible'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateCustomizeUrl(postProperties) {
|
||||||
|
let fullSlug = ''
|
||||||
|
const allSlugPatterns = BLOG.POST_URL_PREFIX.split('/')
|
||||||
|
allSlugPatterns.forEach((pattern, idx) => {
|
||||||
|
if (pattern === '%year%' && postProperties?.date?.start_date) {
|
||||||
|
const formatPostCreatedDate = new Date(postProperties?.date?.start_date)
|
||||||
|
fullSlug += formatPostCreatedDate.getUTCFullYear()
|
||||||
|
} else if (pattern === '%month%' && postProperties?.date?.start_date) {
|
||||||
|
const formatPostCreatedDate = new Date(postProperties?.date?.start_date)
|
||||||
|
fullSlug += String(formatPostCreatedDate.getUTCMonth() + 1).padStart(2, 0)
|
||||||
|
} else if (pattern === '%day%' && postProperties?.date?.start_date) {
|
||||||
|
const formatPostCreatedDate = new Date(postProperties?.date?.start_date)
|
||||||
|
fullSlug += String(formatPostCreatedDate.getUTCDate()).padStart(2, 0)
|
||||||
|
} else if (pattern === '%slug%') {
|
||||||
|
fullSlug += (postProperties.slug ?? postProperties.id)
|
||||||
|
} else if (!pattern.includes('%')) {
|
||||||
|
fullSlug += pattern
|
||||||
|
} else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (idx !== allSlugPatterns.length - 1) {
|
||||||
|
fullSlug += '/'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return `${fullSlug}/${(postProperties.slug ?? postProperties.id)}`
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "notion-next",
|
"name": "notion-next",
|
||||||
"version": "3.12.3",
|
"version": "3.12.4",
|
||||||
"homepage": "https://github.com/tangly1024/NotionNext.git",
|
"homepage": "https://github.com/tangly1024/NotionNext.git",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-facebook": "^8.1.4",
|
"react-facebook": "^8.1.4",
|
||||||
"react-messenger-customer-chat": "^0.8.0",
|
"react-messenger-customer-chat": "^0.8.0",
|
||||||
"react-notion-x": "6.15.8",
|
"react-notion-x": "6.16.0",
|
||||||
"react-share": "^4.4.0",
|
"react-share": "^4.4.0",
|
||||||
"react-tweet-embed": "~2.0.0",
|
"react-tweet-embed": "~2.0.0",
|
||||||
"smoothscroll-polyfill": "^0.4.4",
|
"smoothscroll-polyfill": "^0.4.4",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/* 图片阴影 */
|
/* 图片阴影 */
|
||||||
#notion-article img{
|
#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;
|
box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
|
||||||
|
border-radius: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,15 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
|
|||||||
post.page_cover = siteInfo?.pageCover
|
post.page_cover = siteInfo?.pageCover
|
||||||
}
|
}
|
||||||
const showPageCover = CONFIG_HEXO.POST_LIST_COVER && post?.page_cover
|
const showPageCover = CONFIG_HEXO.POST_LIST_COVER && post?.page_cover
|
||||||
|
const delay = (index % 2) * 200
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
data-aos="fade-up"
|
||||||
|
data-aos-duration="200"
|
||||||
|
data-aos-delay={delay}
|
||||||
|
data-aos-once="true"
|
||||||
|
data-aos-anchor-placement="top-bottom"
|
||||||
key={post.id}
|
key={post.id}
|
||||||
className={`flex md:flex-row flex-col-reverse ${CONFIG_HEXO.POST_LIST_IMG_CROSSOVER ? 'even:md:flex-row-reverse' : ''}
|
className={`flex md:flex-row flex-col-reverse ${CONFIG_HEXO.POST_LIST_IMG_CROSSOVER ? 'even:md:flex-row-reverse' : ''}
|
||||||
w-full justify-between overflow-hidden
|
w-full justify-between overflow-hidden
|
||||||
|
|||||||
@@ -8,18 +8,10 @@ import TagItemMini from './TagItemMini'
|
|||||||
* @param {*} param0
|
* @param {*} param0
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const BlogPostCardInfo = ({ index, post, showPreview, showPageCover, showSummary }) => {
|
export const BlogPostCardInfo = ({ post, showPreview, showPageCover, showSummary }) => {
|
||||||
const delay = (index % 2) * 200
|
return <div className={`h-56 flex flex-col justify-between lg:p-6 p-4 md:max-h-60 ${showPageCover ? 'md:w-7/12 w-full ' : 'w-full'}`}>
|
||||||
|
|
||||||
return <div
|
|
||||||
data-aos="fade-up"
|
|
||||||
data-aos-duration="200"
|
|
||||||
data-aos-delay={delay}
|
|
||||||
data-aos-once="true"
|
|
||||||
data-aos-anchor-placement="top-bottom"
|
|
||||||
className={`h-56 flex flex-col justify-between lg:p-6 p-4 md:max-h-60 ${showPageCover ? 'md:w-7/12 w-full ' : 'w-full'}`}>
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
{/* 标题 */}
|
{/* 标题 */}
|
||||||
<Link
|
<Link
|
||||||
href={`${BLOG.SUB_PATH}/${post.slug}`}
|
href={`${BLOG.SUB_PATH}/${post.slug}`}
|
||||||
|
|||||||
Reference in New Issue
Block a user