Ver Fonte

fix: fix sitemap date bug

rriecc há 2 anos atrás
pai
commit
049998341e
4 ficheiros alterados com 4 adições e 4 exclusões
  1. 1 1
      app/blog/page.tsx
  2. 1 1
      app/sitemap.ts
  3. 1 1
      lib/notion.ts
  4. 1 1
      types/blog.ts

+ 1 - 1
app/blog/page.tsx

@@ -41,7 +41,7 @@ const Page = async () => {
               </CardBody>
               <CardFooter className="flex justify-between">
                 <h3 className="font-[500] text-lg">{title}</h3>
-                <h3 className="text-sm">{createdAt}</h3>
+                <h3 className="text-sm">{createdAt.toDateString()}</h3>
               </CardFooter>
             </Card>
           </Link>

+ 1 - 1
app/sitemap.ts

@@ -20,7 +20,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
 
   const blogs = blogPosts.map(({ id, createdAt }) => ({
     url: `${WEBSITE_HOST_URL}/blog/${id}`,
-    lastModified: createdAt,
+    lastModified: createdAt.toISOString(),
     changeFrequency,
   }));
 

+ 1 - 1
lib/notion.ts

@@ -28,7 +28,7 @@ export async function getAllBlogPosts(pageId: string) {
         block: value.value,
         pageCover: value.value.format?.page_cover,
         title: value.value.properties?.title[0][0],
-        createdAt: new Date(value.value.created_time).toDateString(),
+        createdAt: new Date(value.value.created_time),
       });
     }
   });

+ 1 - 1
types/blog.ts

@@ -5,5 +5,5 @@ export type Blog = {
   title: string;
   block: Block;
   pageCover: string;
-  createdAt: string;
+  createdAt: Date;
 };