Fix twitter metadata

This commit is contained in:
samaradel
2021-08-22 13:45:18 +02:00
parent d087bd5459
commit 44185e321d
3 changed files with 38 additions and 9 deletions

View File

@@ -202,9 +202,10 @@
path
}
}
metadata {
siteUrl
}
}
</page-query>
@@ -246,7 +247,7 @@ export default {
{
key: "og:image",
property: "og:image",
content: this.$page.news.image.src,
content: this.getCoverImage,
},
{
key: "twitter:description",
@@ -256,7 +257,7 @@ export default {
{
key: "twitter:image",
property: "twitter:image",
content: this.$page.news.image.src,
content: this.getCoverImage,
},
{
key: "twitter:title",
@@ -280,5 +281,18 @@ export default {
this.showAlert = val;
},
},
computed: {
getCoverImage() {
let coverImage = "";
const cover = this.$page.news.image;
if (cover != null) {
coverImage = `${this.getBaseUrl}${this.$page.news.image.src}`;
}
return coverImage;
},
getBaseUrl() {
return this.$page.metadata.siteUrl;
},
},
};
</script>