metadata generation nightmare we gotta fix later
This commit is contained in:
@@ -2,9 +2,13 @@ import React from "react";
|
||||
import NavigationButtons from "@/components/NavigationButtons";
|
||||
import { Book, Chapter } from "@/lib/types";
|
||||
import { fetchBookById } from "@/lib/api";
|
||||
import Head from "next/head";
|
||||
export type paramsType = Promise<{ bookId: string; chapterId: string }>;
|
||||
|
||||
export const metadata = {
|
||||
title: 'Null Translation Group',
|
||||
description: 'This is the chapter page default description',
|
||||
};
|
||||
|
||||
// Dynamic page component
|
||||
export default async function ChapterPage(props: { params: paramsType}) {
|
||||
const { bookId, chapterId } = await props.params;
|
||||
@@ -15,17 +19,12 @@ export default async function ChapterPage(props: { params: paramsType}) {
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Chapter not found</title>
|
||||
<meta name="description" content="Chapter not found" />
|
||||
</Head>
|
||||
<div className="prose dark:prose-invert mx-auto p-6 bg-white dark:bg-gray-800 shadow-md rounded-lg mt-4">
|
||||
<div dangerouslySetInnerHTML={{ __html: '<center><h1> Chapter not found !</h1></center>' }}></div>
|
||||
<NavigationButtons bookId={bookId} documentId={chapterId} prevChapter={""} nextChapter={""} />
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -37,31 +36,19 @@ export default async function ChapterPage(props: { params: paramsType}) {
|
||||
|
||||
if(current_chapter === null){
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Chapter not found</title>
|
||||
<meta name="description" content="Chapter not found" />
|
||||
</Head>
|
||||
<div className="prose dark:prose-invert mx-auto p-6 bg-white dark:bg-gray-800 shadow-md rounded-lg mt-4">
|
||||
<div dangerouslySetInnerHTML={{ __html: '<center><h1> Chapter not found !</h1></center>' }}></div>
|
||||
<NavigationButtons bookId={bookId} documentId={chapterId} prevChapter={""} nextChapter={""} />
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{book.title} - Chapter {current_chapter?.number}</title>
|
||||
<meta name="description" content={book.description} />
|
||||
</Head>
|
||||
<div className="prose dark:prose-invert mx-auto p-6 bg-white dark:bg-gray-800 shadow-md rounded-lg mt-4">
|
||||
<NavigationButtons bookId={bookId} documentId={chapterId} prevChapter={prev_chapter} nextChapter={next_chapter} />
|
||||
<div className="pt-4" dangerouslySetInnerHTML={{ __html: current_chapter.content }}></div>
|
||||
|
||||
<NavigationButtons bookId={bookId} documentId={chapterId} prevChapter={prev_chapter} nextChapter={next_chapter}/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user