mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-09 07:26:47 +00:00
example 主题 调整 tag\category 结构
This commit is contained in:
@@ -58,10 +58,10 @@ export async function getStaticProps({ params: { category } }) {
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const from = 'category-paths'
|
||||
const { categories } = await getGlobalNotionData({ from })
|
||||
const { categoryOptions } = await getGlobalNotionData({ from })
|
||||
return {
|
||||
paths: Object.keys(categories).map(category => ({
|
||||
params: { category: categories[category]?.name }
|
||||
paths: Object.keys(categoryOptions).map(category => ({
|
||||
params: { category: categoryOptions[category]?.name }
|
||||
})),
|
||||
fallback: true
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ export async function getStaticProps({ params: { category, page } }) {
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const from = 'category-paths'
|
||||
const { categories, allPages } = await getGlobalNotionData({ from })
|
||||
const { categoryOptions, allPages } = await getGlobalNotionData({ from })
|
||||
const paths = []
|
||||
|
||||
categories?.forEach(category => {
|
||||
categoryOptions?.forEach(category => {
|
||||
// 过滤状态类型
|
||||
const categoryPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published').filter(post => post && post.category && post.category.includes(category.name))
|
||||
// 处理文章页数
|
||||
|
||||
@@ -2,7 +2,6 @@ import { getGlobalNotionData } from '@/lib/notion/getNotionData'
|
||||
import React from 'react'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import * as ThemeMap from '@/themes'
|
||||
import { getAllCategories } from '@/lib/notion/getAllCategories'
|
||||
import BLOG from '@/blog.config'
|
||||
|
||||
/**
|
||||
@@ -27,8 +26,6 @@ export default function Category(props) {
|
||||
|
||||
export async function getStaticProps() {
|
||||
const props = await getGlobalNotionData({ from: 'category-index-props' })
|
||||
props.categories = getAllCategories({ allPages: props.allPages, categoryOptions: props.categoryOptions, sliceCount: 0 })
|
||||
delete props.categoryOptions
|
||||
delete props.allPages
|
||||
return {
|
||||
props,
|
||||
|
||||
Reference in New Issue
Block a user