docs: generate open graph images for all pages

This commit is contained in:
Hans Pagel
2021-02-03 15:04:18 +01:00
parent 8ff0997f3e
commit c7501f6eb7
26 changed files with 162 additions and 12 deletions

View File

@@ -31,7 +31,7 @@ export default {
},
{
property: 'og:image',
content: 'https://next.tiptap.dev/og-image.png',
content: this.getOpenGraphImage(),
},
/* Twitter */
{
@@ -44,7 +44,7 @@ export default {
},
{
name: 'twitter:image',
content: 'https://next.tiptap.dev/og-image.png',
content: this.getOpenGraphImage(),
},
{
name: 'twitter:site',
@@ -53,6 +53,15 @@ export default {
],
}
},
methods: {
getOpenGraphImage() {
const path = this.$route.path.replace(/\/$/, '')
return path === ''
? 'https://next.tiptap.dev/og-image.png'
: `/images${path}/og-image.png`
},
},
}
</script>