站点信息读取Notion数据

This commit is contained in:
tangly1024
2022-03-30 15:34:25 +08:00
parent 914e9a108f
commit 53c004843e
61 changed files with 322 additions and 463 deletions

View File

@@ -1,6 +1,6 @@
import LayoutBase from './LayoutBase'
export const Layout404 = (props) => {
export const Layout404 = props => {
return <LayoutBase {...props}>
<div className='w-full h-96 py-80 flex justify-center items-center'>404 Not found.</div>
</LayoutBase>

View File

@@ -1,11 +1,9 @@
import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import LayoutBase from './LayoutBase'
export const LayoutArchive = props => {
const { posts } = props
const { locale } = useGlobal()
const postsSortByDate = Object.create(posts)
postsSortByDate.sort((a, b) => {
@@ -14,12 +12,6 @@ export const LayoutArchive = props => {
return dateB - dateA
})
const meta = {
title: `${locale.NAV.ARCHIVE} | ${BLOG.TITLE}`,
description: BLOG.DESCRIPTION,
type: 'website'
}
const archivePosts = {}
postsSortByDate.forEach(post => {
@@ -31,7 +23,7 @@ export const LayoutArchive = props => {
}
})
return (
<LayoutBase {...props} meta={meta}>
<LayoutBase {...props}>
<div className="mb-10 pb-20 md:p-12 p-3 min-h-full">
{Object.keys(archivePosts).map(archiveTitle => (
<div key={archiveTitle}>

View File

@@ -1,7 +1,7 @@
import LayoutBase from './LayoutBase'
import BlogPostListScroll from './components/BlogPostListScroll'
export const LayoutCategory = (props) => {
export const LayoutCategory = props => {
const { category } = props
const slotTop = <div className='flex items-center font-sans p-8'><div className='text-xl'><i className='mr-2 fas fa-th'/>分类</div>{category}</div>

View File

@@ -1,4 +1,3 @@
import BLOG from '@/blog.config'
import { getPageTableOfContents } from 'notion-utils'
import LayoutBase from './LayoutBase'
@@ -11,12 +10,6 @@ import { ArticleLock } from './components/ArticleLock'
export const LayoutSlug = props => {
const { post, lock, validPassword } = props
const meta = {
title: `${post.title} | ${BLOG.TITLE}`,
description: post.summary,
type: 'article',
tags: post.tags
}
if (!lock && post?.blockMap?.block) {
post.content = Object.keys(post.blockMap.block)
@@ -53,7 +46,6 @@ export const LayoutSlug = props => {
return (
<LayoutBase
{...props}
meta={meta}
showInfoCard={true}
slotRight={slotRight}
>

View File

@@ -1,10 +1,10 @@
import BLOG from '@/blog.config'
import Link from 'next/link'
export default function LogoBar () {
export default function LogoBar (props) {
const { siteInfo } = props
return <div id='top-wrapper' className='w-full flex items-center font-sans'>
<Link href='/'>
<a className='text-md md:text-xl dark:text-gray-200'>{BLOG.TITLE}</a>
<a className='text-md md:text-xl dark:text-gray-200'>{siteInfo.title}</a>
</Link>
</div>
}

View File

@@ -13,7 +13,7 @@ export default function TopNavBar (props) {
return <div id='top-nav' className={'sticky top-0 lg:relative w-full z-40 ' + className}>
<div className='flex w-full h-12 shadow bg-white dark:bg-gray-900 px-5 items-between'>
<LogoBar />
<LogoBar {...props}/>
{/* 顶部菜单 */}
<div className='flex'>