Leo преди 3 години
родител
ревизия
9663230180
променени са 1 файла, в които са добавени 7 реда и са изтрити 10 реда
  1. 7 10
      pages/novel/[slug]/[chapter].tsx

+ 7 - 10
pages/novel/[slug]/[chapter].tsx

@@ -52,10 +52,7 @@ const Chapter: NextPageWithLayout<NovelPageProps> = (props) => {
     const url = `https://${siteConfig.host}/novel/${query.slug}/${query.chapter}`;
     return {
       title: `${chapterData?.title} - ${chapterData?.chapter} - ${siteConfig.siteName}`,
-      // TODO: 作者
-      description: `Read ${chapterData?.title} ${chapterData?.chapter} on ${
-        siteConfig.siteName
-      }. ${chapterData?.title} novel written by ${"作者"}.`,
+      description: `Read ${chapterData?.title} ${chapterData?.chapter} on ${siteConfig.siteName}. ${chapterData?.title} novel written by ${detail?.author}.`,
       keywords: `${[
         chapterData?.title,
         chapterData?.chapter,
@@ -73,8 +70,7 @@ const Chapter: NextPageWithLayout<NovelPageProps> = (props) => {
         ? `https://${siteConfig.host}/novel/${chapterData.next}`
         : "",
       siteName: siteConfig.siteName,
-      // TODO: 图片
-      img: "",
+      img: detail?.img,
       jsonLd: chapterData
         ? JSON.stringify([
             {
@@ -84,8 +80,7 @@ const Chapter: NextPageWithLayout<NovelPageProps> = (props) => {
               headline: `${chapterData?.title || ""} - ${
                 chapterData?.chapter || ""
               }`,
-              // TODO: 更新时间
-              datePublished: "2018-03-16T02:13:00.000Z",
+              datePublished: detail?.update_time,
               publisher: {
                 "@type": "Organization",
                 name: siteConfig.siteName,
@@ -97,8 +92,7 @@ const Chapter: NextPageWithLayout<NovelPageProps> = (props) => {
                 isAccessibleForFree: true,
                 cssSelector: styles["novel"],
               },
-              // TODO: 作者
-              author: { "@type": "Person", name: "作者" },
+              author: { "@type": "Person", name: detail?.author },
             },
             {
               "@context": "https://schema.org",
@@ -132,6 +126,9 @@ const Chapter: NextPageWithLayout<NovelPageProps> = (props) => {
     };
   }, [
     chapterData,
+    detail?.author,
+    detail?.img,
+    detail?.update_time,
     query.chapter,
     query.slug,
     siteConfig.host,