Update twitter metadata

This commit is contained in:
samaradel
2021-08-05 11:27:37 +02:00
parent 0d8163aa38
commit 41c37e21b4
2 changed files with 22 additions and 5 deletions

View File

@@ -236,6 +236,11 @@ export default {
linkCopied(val) {
this.showAlert = val;
},
img(image) {
if (!image) return "";
if (image.src) return image.src;
return image;
},
},
metaInfo() {
return {
@@ -260,7 +265,7 @@ export default {
{
key: "og:image",
property: "og:image",
content: this.$page.blog.image.src,
content: this.img(this.$page.blog.image),
},
{
key: "twitter:description",
@@ -270,7 +275,7 @@ export default {
{
key: "twitter:image",
property: "twitter:image",
content: this.$page.blog.image.src,
content: this.img(this.$page.blog.image),
},
{
key: "twitter:title",
@@ -280,7 +285,7 @@ export default {
{
key: "twitter:card",
name: "twitter:card",
content: this.$page.blog.image.src,
content: this.$page.blog.excerpt,
},
],
};

View File

@@ -222,6 +222,13 @@ export default {
return pluralize("post", this.$page.project.belongsTo.totalCount);
},
},
methods: {
img(image) {
if (!image) return "";
if (image.src) return image.src;
return image;
},
},
metaInfo() {
return {
title: "",
@@ -245,7 +252,7 @@ export default {
{
key: "og:image",
property: "og:image",
content: this.$page.project.image.src,
content: this.img(this.$page.project.image),
},
{
key: "twitter:description",
@@ -255,13 +262,18 @@ export default {
{
key: "twitter:image",
property: "twitter:image",
content: this.$page.project.image.src,
content: this.img(this.$page.project.image),
},
{
key: "twitter:title",
property: "twitter:title",
content: this.$page.project.title,
},
{
key: "twitter:card",
name: "twitter:card",
content: this.$page.project.excerpt,
},
],
};
},