Skip to content

Commit b2af23b

Browse files
fix: open graph in website
1 parent 8c5d7c2 commit b2af23b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

website/doc/.vitepress/config.mts

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ export default defineConfig({
2525
const head: HeadConfig[] = []
2626

2727
head.push(['meta', { property: 'og:title', content: pageData.frontmatter.title }])
28-
head.push(['meta', { property: 'og:url', content: path.join(hostname,page.replace('.md','.html')) }])
28+
head.push(['meta', { property: 'og:url', content: new URL(page.replace('.md','.html'),hostname).toString() }])
2929
head.push(['meta', { property: 'og:description', content: pageData.frontmatter.description }])
3030
head.push(['meta', { property: 'og:type', content: 'website' }])
31-
head.push(['meta', { property: 'twitter:card', content: 'summary' }])
31+
head.push(['meta', { property: 'twitter:card', content: 'summary_large_image' }])
3232
head.push(['meta', { property: 'twitter:site', content: '@purista_js' }])
33-
head.push(['meta', { property: 'twitter:creator', content: '@swessel78' }])
33+
head.push(['meta', { property: 'twitter:creator', content: '@purista_js' }])
3434

3535
if(pageData.frontmatter.image) {
36-
head.push(['meta', { property: 'og:image', content: path.join(hostname,pageData.frontmatter.image) }])
36+
head.push(['meta', { property: 'og:image', content: new URL(pageData.frontmatter.image,hostname).toString() }])
3737
}else {
3838
head.push(['meta', { property: 'og:image', content: `https://ogpreview-ten.vercel.app/api/og?title=${encodeURIComponent(pageData.frontmatter.title)}&description=${encodeURIComponent(pageData.frontmatter.description)}` }])
3939
}

0 commit comments

Comments
 (0)