在编写一些单元测试时,我有一个使用Vue-meta设置元信息的组件
我的组件看起来像这样。
export default {
...
metaInfo () {
const expertName = this.getBlogInfo.blog.author.trim()
const fullName = expertName ? `${expertName.first_name} ${expertName.last_name}` : 'Cowsoko'
return {
title: `Dairynomics - Blog post from ${fullName}`,
meta: [
{
vmid: 'og:description',
name: 'og:description',
content: this.description
},
{
vmid: 'og:image',
name: 'og:image',
content: this.getBlogInfo.blog.photo
}
]
}
}
...
答案 0 :(得分:1)
您可以正常地在每个组件中插入元数据。 如果您的页面是动态的,并且您想要任何动态的SEO或元标记,则可以使用vue-headful。 像这样
<vue-headful
title="Title from vue-headful"
description="Description from vue-headful"
/>
在vue-headful中,您可以编写所有元标记。