@@ -5,7 +5,8 @@ import { renderBlock } from '../../components/article/render-article-block';
55import { Text } from '../../components/article/text' ;
66import Footer from '../../components/homepage/footer' ;
77import Header from '../../components/homepage/header' ;
8- import { getBlocks , getDatabase , getPageBySlug } from '../../lib/notion' ;
8+ import { getBlocks , getItemsFromDatabase , getPageBySlug } from '../../lib/notion' ;
9+ import Custom404 from '../404' ;
910import { PostsList , postsDatabaseId } from '../index' ;
1011import styles from './writing.module.css' ;
1112
@@ -15,7 +16,7 @@ export type Block = Params['blocks'][0];
1516
1617export default function Post ( { page, blocks, posts } : Params ) {
1718 if ( ! page || ! blocks ) {
18- return < div /> ;
19+ return < Custom404 /> ;
1920 }
2021 const excerpt = ( page . properties . Excerpt as any ) . rich_text [ 0 ] ?. plain_text ;
2122 const title = ( page . properties . Title as any ) . title [ 0 ] . plain_text ;
@@ -60,7 +61,7 @@ export default function Post({ page, blocks, posts }: Params) {
6061}
6162
6263export const getStaticPaths = async ( ) => {
63- const database = await getDatabase ( postsDatabaseId ) ;
64+ const database = await getItemsFromDatabase ( postsDatabaseId ) ;
6465 const paths = database
6566 . map ( ( post ) => {
6667 const slug = ( post . properties . Slug as any ) . rich_text [ 0 ] ?. plain_text ;
@@ -77,7 +78,7 @@ export const getStaticPaths = async () => {
7778
7879export const getStaticProps = async ( context : { params : { id : string } } ) => {
7980 const { id } = context . params ;
80- const posts = await getDatabase ( postsDatabaseId ) ;
81+ const posts = await getItemsFromDatabase ( postsDatabaseId ) ;
8182 const page = await getPageBySlug ( id , postsDatabaseId ) ;
8283 const blocks = await getBlocks ( page . id ) ;
8384
0 commit comments