This commit is contained in:
tangly1024.com
2023-06-30 14:28:15 +08:00
parent 96908a9290
commit 0f7e5f2fb9
26 changed files with 74 additions and 75 deletions

View File

@@ -1,4 +1,4 @@
import { getGlobalNotionData } from '@/lib/notion/getNotionData'
import { getGlobalData } from '@/lib/notion/getNotionData'
import React from 'react'
import { useGlobal } from '@/lib/global'
import BLOG from '@/blog.config'
@@ -34,7 +34,7 @@ export default function Category(props) {
export async function getStaticProps({ params: { category } }) {
const from = 'category-props'
let props = await getGlobalNotionData({ from })
let props = await getGlobalData({ from })
// 过滤状态
props.posts = props.allPages.filter(page => page.type === 'Post' && page.status === 'Published')
@@ -61,7 +61,7 @@ export async function getStaticProps({ params: { category } }) {
export async function getStaticPaths() {
const from = 'category-paths'
const { categoryOptions } = await getGlobalNotionData({ from })
const { categoryOptions } = await getGlobalData({ from })
return {
paths: Object.keys(categoryOptions).map(category => ({
params: { category: categoryOptions[category]?.name }

View File

@@ -1,4 +1,4 @@
import { getGlobalNotionData } from '@/lib/notion/getNotionData'
import { getGlobalData } from '@/lib/notion/getNotionData'
import React from 'react'
import { useGlobal } from '@/lib/global'
import BLOG from '@/blog.config'
@@ -34,7 +34,7 @@ export default function Category(props) {
export async function getStaticProps({ params: { category, page } }) {
const from = 'category-page-props'
let props = await getGlobalNotionData({ from })
let props = await getGlobalData({ from })
// 过滤状态类型
props.posts = props.allPages.filter(page => page.type === 'Post' && page.status === 'Published').filter(post => post && post.category && post.category.includes(category))
@@ -56,7 +56,7 @@ export async function getStaticProps({ params: { category, page } }) {
export async function getStaticPaths() {
const from = 'category-paths'
const { categoryOptions, allPages } = await getGlobalNotionData({ from })
const { categoryOptions, allPages } = await getGlobalData({ from })
const paths = []
categoryOptions?.forEach(category => {

View File

@@ -1,4 +1,4 @@
import { getGlobalNotionData } from '@/lib/notion/getNotionData'
import { getGlobalData } from '@/lib/notion/getNotionData'
import React from 'react'
import { useGlobal } from '@/lib/global'
import BLOG from '@/blog.config'
@@ -30,7 +30,7 @@ export default function Category(props) {
}
export async function getStaticProps() {
const props = await getGlobalNotionData({ from: 'category-index-props' })
const props = await getGlobalData({ from: 'category-index-props' })
delete props.allPages
return {
props,