Skip to content

Commit

Permalink
🔨 fix publishedDate format
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulrcs committed Apr 2, 2024
1 parent 30170d1 commit 6e6cd52
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pages/blog/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { GithubBlog } from '@rena.to/github-blog'

import useUtterances from '../../hook/useUtterances'

export default function Post({ metadata, source }) {
export default function Post({ metadata, publishedDate, source }) {
const [views, setViews] = useState('...')
const router = useRouter()
const { slug } = router.query
Expand All @@ -53,8 +53,8 @@ export default function Post({ metadata, source }) {
type: 'article',
article: {
authors: ['Abdul Rahman'],
publishedTime: metadata.date,
modifiedTime: metadata.date,
publishedTime: publishedDate,
modifiedTime: publishedDate,
tags: ['Programming', 'Web Development', 'Software Engineering'],
},
images: [
Expand All @@ -79,8 +79,8 @@ export default function Post({ metadata, source }) {
url={`https://abdulrahman.id/blog/${slug}`}
title={metadata.title}
images={[metadata.frontmatter.image]}
datePublished={metadata.date}
dateModified={metadata.date}
datePublished={publishedDate}
dateModified={publishedDate}
authorName="Abdul Rahman"
publisherName="Abdul Rahman"
publisherLogo="https://imagizer.imageshack.com/a/img923/7612/A5tDeP.png"
Expand Down Expand Up @@ -114,7 +114,7 @@ export default function Post({ metadata, source }) {
/>
<Text fontSize={['xs', 'xs', 'sm', 'sm']} color="textPrimary">
Abdul Rahman /{' '}
{dateFormat(Date.parse(metadata.date), 'mmmm d, yyyy')}
{dateFormat(Date.parse(publishedDate), 'mmmm d, yyyy')}
</Text>
</Stack>
<Stack>
Expand Down Expand Up @@ -209,6 +209,7 @@ export async function getStaticProps({ params }) {
return {
props: {
metadata: article,
publishedDate: new Date(article.frontmatter.date).toISOString(),
source: mdxSource,
},
revalidate: 30,
Expand Down

0 comments on commit 6e6cd52

Please sign in to comment.