mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-20 07:26:46 +00:00
站点信息读取Notion数据
This commit is contained in:
@@ -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}>
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useGlobal } from '@/lib/global'
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = props => {
|
||||
const { children, meta, customNav } = props
|
||||
const { children, meta, customNav, siteInfo } = props
|
||||
const { locale } = useGlobal()
|
||||
const d = new Date()
|
||||
const currentYear = d.getFullYear()
|
||||
@@ -35,10 +35,10 @@ const LayoutBase = props => {
|
||||
<div className="w-full flex justify-center my-2">
|
||||
<div className=" max-w-6xl justify-between w-full flex">
|
||||
<section>
|
||||
<Link title={BLOG.TITLE} href={'/'}>
|
||||
<Link title={siteInfo.title} href={'/'}>
|
||||
<a className={'cursor-pointer flex items-center hover:underline'}>
|
||||
<i className={'fas fa-home mr-1'} />
|
||||
<div className="text-center">{BLOG.TITLE} </div>
|
||||
<div className="text-center">{siteInfo.title} </div>
|
||||
</a>
|
||||
</Link>
|
||||
</section>
|
||||
@@ -126,7 +126,7 @@ const LayoutBase = props => {
|
||||
<span className="px-1 busuanzi_value_site_uv"> </span>{' '}
|
||||
</span>
|
||||
<br />
|
||||
<h1>{meta?.title || BLOG.TITLE}</h1>
|
||||
<h1>{meta?.title || siteInfo.title}</h1>
|
||||
</footer>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import BLOG from '@/blog.config'
|
||||
import { getPageTableOfContents } from 'notion-utils'
|
||||
import 'prismjs'
|
||||
import 'prismjs/components/prism-bash'
|
||||
@@ -24,13 +23,6 @@ const mapPageUrl = id => {
|
||||
|
||||
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)
|
||||
post.toc = getPageTableOfContents(post, post.blockMap)
|
||||
@@ -55,7 +47,7 @@ export const LayoutSlug = props => {
|
||||
}
|
||||
})
|
||||
return (
|
||||
<LayoutBase {...props} meta={meta}>
|
||||
<LayoutBase {...props}>
|
||||
<div>
|
||||
<h2>{post?.title}</h2>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user