From 00800b4e16d02779e7004178d5b36ba3a4a2989b Mon Sep 17 00:00:00 2001 From: rezafikkri Date: Sat, 21 Dec 2024 11:48:43 +0700 Subject: [PATCH] feat: set explicit timezone in json-ld dateModified in detail blogs page --- app/blogs/[slug]/page.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/blogs/[slug]/page.jsx b/app/blogs/[slug]/page.jsx index 7d8096a..d9ca5b0 100644 --- a/app/blogs/[slug]/page.jsx +++ b/app/blogs/[slug]/page.jsx @@ -1,4 +1,6 @@ import dayjs from "dayjs"; +import utc from 'dayjs/plugin/utc'; +import timezone from 'dayjs/plugin/timezone'; import Pagination from "@/components/post/pagination"; import PostContent from "@/components/post/post-content"; import SmallTopics from "@/components/post/small-topics"; @@ -8,6 +10,9 @@ import getBaseUrl from "@/lib/get-base-url"; const baseUrl = getBaseUrl(); +dayjs.extend(utc); +dayjs.extend(timezone); + export async function generateMetadata({ params }) { const slug = (await params).slug; const post = getPost(slug); @@ -39,7 +44,7 @@ export default async function Page({ params }) { '@type': 'Article', headline: post.title, image: [ post.ogImage ], - dateModified: dayjs(post.lastmod).format(), + dateModified: dayjs(post.lastmod).tz('UTC').format('YYYY-MM-DDTHH:mm:ssZ'), author: [ { '@type': 'Person',