mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-05 15:10:26 +00:00
Add facebook Open Graph Url and image. Fix PATH env conflict with Vercel environment
This commit is contained in:
@@ -3,23 +3,26 @@ import React from 'react'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import * as ThemeMap from '@/themes'
|
||||
|
||||
export default function Category (props) {
|
||||
export default function Category(props) {
|
||||
const { theme } = useGlobal()
|
||||
const ThemeComponents = ThemeMap[theme]
|
||||
const { siteInfo, posts } = props
|
||||
const { locale } = useGlobal()
|
||||
if (!posts) {
|
||||
return <ThemeComponents.Layout404 {...props}/>
|
||||
return <ThemeComponents.Layout404 {...props} />
|
||||
}
|
||||
const meta = {
|
||||
title: `${props.category} | ${locale.COMMON.CATEGORY} | ${siteInfo?.title || ''}`,
|
||||
title: `${props.category} | ${locale.COMMON.CATEGORY} | ${
|
||||
siteInfo?.title || ''
|
||||
}`,
|
||||
description: siteInfo?.description,
|
||||
slug: 'category/' + props.category,
|
||||
type: 'website'
|
||||
}
|
||||
return <ThemeComponents.LayoutCategory {...props} meta={meta} />
|
||||
}
|
||||
|
||||
export async function getStaticProps ({ params: { category } }) {
|
||||
export async function getStaticProps({ params: { category } }) {
|
||||
const from = 'category-props'
|
||||
let props = await getGlobalNotionData({ from })
|
||||
const posts = props.allPosts.filter(
|
||||
@@ -33,11 +36,13 @@ export async function getStaticProps ({ params: { category } }) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function getStaticPaths () {
|
||||
export async function getStaticPaths() {
|
||||
const from = 'category-paths'
|
||||
const { categories } = await getGlobalNotionData({ from })
|
||||
return {
|
||||
paths: Object.keys(categories).map(category => ({ params: { category: categories[category]?.name } })),
|
||||
paths: Object.keys(categories).map(category => ({
|
||||
params: { category: categories[category]?.name }
|
||||
})),
|
||||
fallback: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import React from 'react'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import * as ThemeMap from '@/themes'
|
||||
|
||||
export default function Category (props) {
|
||||
export default function Category(props) {
|
||||
const { theme } = useGlobal()
|
||||
const ThemeComponents = ThemeMap[theme]
|
||||
const { locale } = useGlobal()
|
||||
@@ -11,13 +11,17 @@ export default function Category (props) {
|
||||
const meta = {
|
||||
title: `${locale.COMMON.CATEGORY} | ${siteInfo.title}`,
|
||||
description: siteInfo.description,
|
||||
slug: 'category',
|
||||
type: 'website'
|
||||
}
|
||||
return <ThemeComponents.LayoutCategoryIndex {...props} meta={meta}/>
|
||||
return <ThemeComponents.LayoutCategoryIndex {...props} meta={meta} />
|
||||
}
|
||||
|
||||
export async function getStaticProps () {
|
||||
const props = await getGlobalNotionData({ from: 'category-index-props', categoryCount: 0 })
|
||||
export async function getStaticProps() {
|
||||
const props = await getGlobalNotionData({
|
||||
from: 'category-index-props',
|
||||
categoryCount: 0
|
||||
})
|
||||
return {
|
||||
props,
|
||||
revalidate: 1
|
||||
|
||||
Reference in New Issue
Block a user