Skip to content

Commit

Permalink
fix: only push date when date is available
Browse files Browse the repository at this point in the history
  • Loading branch information
fdevans committed Sep 29, 2023
1 parent 44cbebe commit 7c42ac5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ export let openGraphPlugin =

if (!page.frontmatter.layout) {
head.push(['meta', { property: 'og:type', content: 'article' }])

head.push([
'meta',
{
content: new Date(page.frontmatter.date!).toISOString(),
property: 'article:published_time',
},
])
if (page.frontmatter.date) {
head.push([
'meta',
{
content: new Date(page.frontmatter.date!).toISOString(),
property: 'article:published_time',
},
])
}
}

head.push([
Expand Down

0 comments on commit 7c42ac5

Please sign in to comment.