Skip to content

Commit

Permalink
Merge pull request #7 from andreacanton/master
Browse files Browse the repository at this point in the history
fix print 'true'+image_path for image default option
  • Loading branch information
lorisleiva authored Jun 28, 2020
2 parents de13ee1 + a7e3140 commit bab7b1c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ const defaultOptions = {
twitterCard: _ => 'summary_large_image',
type: $page => ['articles', 'posts', 'blog'].some(folder => $page.regularPath.startsWith('/' + folder)) ? 'article' : 'website',
url: (_, $site, path) => ($site.themeConfig.domain || '') + path,
image: ($page, $site) => $page.frontmatter.image && (($site.themeConfig.domain && !$page.frontmatter.image.startsWith('http') || '') + $page.frontmatter.image),
image: ($page, $site) => {
if ($page.frontmatter.image) {
return $site.themeConfig.domain &&
!$page.frontmatter.image.startsWith('http')
? $site.themeConfig.domain + $page.frontmatter.image
: $page.frontmatter.image;
}
return '';
},
publishedAt: $page => $page.frontmatter.date && (new Date($page.frontmatter.date)).toISOString(),
modifiedAt: $page => $page.lastUpdated && (new Date($page.lastUpdated)).toISOString(),
customMeta: () => {},
Expand Down

0 comments on commit bab7b1c

Please sign in to comment.