我有一个 Vue.js 应用程序,当链接在社交媒体(主要是 Facebook)上共享时,我想使用 Open Graph Meta Tags 来显示一些内容(标题、描述、图像)。
我使用 vue-meta 在我使用标题模板的地方显示标题,并且该部分运行良好(除了一个问题,解决后可能会解决)。
metaInfo () {
return {
titleTemplate: this.item.title + ' | %s',
meta: [
{property: 'og:title', content: ' | My Site'},
{property: 'og:site_name', content: 'My Site'},
// The list of types is available here: http://ogp.me/#types
{property: 'og:type', content: 'website'},
// Should the the same as your canonical link, see below.
{property: 'og:url', content: 'https://www.my-site.com/my-special-page'},
{property: 'og:image', content: 'https://www.my-site.com/my-special-image.jpg'},
// Often the same as your meta description, but not always. …
Run Code Online (Sandbox Code Playgroud)