Add facebook Open Graph Url and image. Fix PATH env conflict with Vercel environment

This commit is contained in:
txs
2022-04-04 08:13:18 +08:00
parent 305a476f6f
commit ebdaf4273f
33 changed files with 901 additions and 469 deletions

View File

@@ -3,19 +3,21 @@ import { getPostBlocks } from '@/lib/notion'
import { getGlobalNotionData } from '@/lib/notion/getNotionData'
import * as ThemeMap from '@/themes'
import { useGlobal } from '@/lib/global'
const Index = (props) => {
const Index = props => {
const { theme } = useGlobal()
const ThemeComponents = ThemeMap[theme]
return <ThemeComponents.LayoutIndex {...props}/>
return <ThemeComponents.LayoutIndex {...props} />
}
export async function getStaticProps () {
export async function getStaticProps() {
const from = 'index'
const props = await getGlobalNotionData({ from, pageType: ['Post'] })
const { allPosts, siteInfo } = props
const meta = {
title: `${siteInfo.title} | ${siteInfo.description}`,
description: siteInfo.description,
image: siteInfo.pageCover,
slug: '',
type: 'website'
}
@@ -35,7 +37,11 @@ export async function getStaticProps () {
if (post.password && post.password !== '') {
continue
}
const blockMap = await getPostBlocks(post.id, 'slug', BLOG.POST_PREVIEW_LINES)
const blockMap = await getPostBlocks(
post.id,
'slug',
BLOG.POST_PREVIEW_LINES
)
if (blockMap) {
post.blockMap = blockMap
}
@@ -46,7 +52,8 @@ export async function getStaticProps () {
return {
props: {
meta, ...props
meta,
...props
},
revalidate: 1
}