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,5 +1,5 @@
import { useGlobal } from '@/lib/global'
import { getGlobalNotionData } from '@/lib/notion/getNotionData'
import { getGlobalData } from '@/lib/notion/getNotionData'
import BLOG from '@/blog.config'
import { useRouter } from 'next/router'
import { getLayoutByTheme } from '@/themes/theme'
@@ -30,7 +30,7 @@ const Tag = props => {
export async function getStaticProps({ params: { tag } }) {
const from = 'tag-props'
const props = await getGlobalNotionData({ from })
const props = await getGlobalData({ from })
// 过滤状态
props.posts = props.allPages.filter(page => page.type === 'Post' && page.status === 'Published').filter(post => post && post.tags && post.tags.includes(tag))
@@ -68,7 +68,7 @@ function getTagNames(tags) {
export async function getStaticPaths() {
const from = 'tag-static-path'
const { tagOptions } = await getGlobalNotionData({ from })
const { tagOptions } = await getGlobalData({ from })
const tagNames = getTagNames(tagOptions)
return {

View File

@@ -1,5 +1,5 @@
import { useGlobal } from '@/lib/global'
import { getGlobalNotionData } from '@/lib/notion/getNotionData'
import { getGlobalData } from '@/lib/notion/getNotionData'
import BLOG from '@/blog.config'
import { useRouter } from 'next/router'
import { getLayoutByTheme } from '@/themes/theme'
@@ -25,7 +25,7 @@ const Tag = props => {
export async function getStaticProps({ params: { tag, page } }) {
const from = 'tag-page-props'
const props = await getGlobalNotionData({ from })
const props = await getGlobalData({ from })
// 过滤状态、标签
props.posts = props.allPages.filter(page => page.type === 'Post' && page.status === 'Published').filter(post => post && post.tags && post.tags.includes(tag))
// 处理文章数
@@ -44,7 +44,7 @@ export async function getStaticProps({ params: { tag, page } }) {
export async function getStaticPaths() {
const from = 'tag-page-static-path'
const { tagOptions, allPages } = await getGlobalNotionData({ from })
const { tagOptions, allPages } = await getGlobalData({ from })
const paths = []
tagOptions?.forEach(tag => {
// 过滤状态类型

View File

@@ -1,4 +1,4 @@
import { getGlobalNotionData } from '@/lib/notion/getNotionData'
import { getGlobalData } from '@/lib/notion/getNotionData'
import { useGlobal } from '@/lib/global'
import BLOG from '@/blog.config'
import { useRouter } from 'next/router'
@@ -30,7 +30,7 @@ const TagIndex = props => {
export async function getStaticProps() {
const from = 'tag-index-props'
const props = await getGlobalNotionData({ from })
const props = await getGlobalData({ from })
delete props.allPages
return {
props,