From 4c4236408321a0f6d9917c3da3d33c7af4fc303e Mon Sep 17 00:00:00 2001 From: Hippo Date: Sun, 26 Apr 2020 22:24:12 +0530 Subject: [PATCH] Display meta tags (for Facebook, Twitter, etc.) Social media, here we come! --- src/templates/GhostPost.vue | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/templates/GhostPost.vue b/src/templates/GhostPost.vue index 88e0a12..edce938 100644 --- a/src/templates/GhostPost.vue +++ b/src/templates/GhostPost.vue @@ -86,8 +86,46 @@ export default { } else { bodyAttrs = "page-template" } + + let baseUrl = this.$static.metadata.siteUrl||this.$static.metadata.ghost.url + + let meta = [ + { property: 'og:site_name', content: 'Snipette' }, + { property: 'og:type', content: 'article' }, + { property: 'og:title', content: this.thisPost.title }, + { property: 'og:description', content: this.thisPost.description }, + { property: 'og:url', content: baseUrl + this.thisPost.path }, + { property: 'og:image', content: changeUrls(this.thisPost.image) }, + { property: 'article:published_time', content: this.thisPost.date }, + ] + + for (var i=0; i{return t.title}).join(',') }, + ]) + + if (Admin.social_media && Admin.social_media.twitter) { + meta.push({ property: 'twitter:site', content: '@' + Admin.social_media.twitter }) + } + return { title: this.$page.post ? this.$page.post.title : this.$page.page.title, + meta: meta, bodyAttrs: { class: bodyAttrs } @@ -184,6 +222,7 @@ export default { query Metadata { metadata { + siteUrl ghost { title url