Hi, i have a idea for Defaults
As example
In my app.vue i have
metaInfo: {
title: 'Renka',
meta: [
{
name: 'description', content: 'bar'
},
{
property: 'og:title',
content: 'Default'
},
{
property: 'og_sitename',
content: 'Default'
},
{
property: 'og:image',
content: 'Default'
}
]
}
and when i open my Home.vue
which comes from <router-view></router-view> in my App.vue
metaInfo: {
title: 'Home',
meta: [
{
name: 'description', content: 'bar'
},
{
property: 'og:title',
content: 'Test'
},
{
property: 'og:image',
content: 'Test'
}
]
},
Will overwrite my whole meta tags and og_sitename is gone
i could just make my own function which will merge both objects but then i need todo this over and over
i think a i simple solution would be pass the defaults via Options or something i would do a Pr but yea.. my js is not the best :P
awesome plugin! 馃拑
That shouldn't be happening and is not how it works in the app I use to test vue-meta, but I do spot something wrong with your code. Try this:
App
metaInfo: {
title: 'Renka',
meta: [
{
vmid: 'description',
name: 'description',
content: 'bar'
},
{
vmid: 'og:title',
property: 'og:title',
content: 'Default'
},
{
vmid: 'og_sitename',
property: 'og_sitename',
content: 'Default'
},
{
vmid: 'og:image',
property: 'og:image',
content: 'Default'
}
]
}
Home
metaInfo: {
title: 'Home',
meta: [
{
vmid: 'description',
name: 'description',
content: 'bar'
},
{
vmid: 'og:title',
property: 'og:title',
content: 'Test'
},
{
vmid: 'og:image',
property: 'og:image',
content: 'Test'
}
]
}
vue-meta needs to know which tags are related and need to be overriden - it does this by checking which tags share the same vmid.
thx, i tested,
i got same Result as before og_sitename is gone
Defaults which includes the og_sitename with vmid
From my app.vue
metaInfo: {
title() {
return defaultMeta.metaInfo.title //points to my title from a other js file
},
meta() {
return defaultMeta.metaInfo.meta //points to my meta from a other js file wich includes sitename
}
},
Any in my Home which has no og_sitename in the meta
i have
metaInfo: {
title() {
return this.locals.metaInfo.title
},
meta() {
return this.locals.metaInfo.meta
}
},
i throught i fixed but i was on the wrong site xD
i found something
When i use
meta: [
{
vmid: 'description',
name: 'description',
content: 'bar'
},
{
vmid: 'og:title',
property: 'og:title',
content: 'Test'
},
{
vmid: 'og:image',
property: 'og:image',
content: 'Test'
}
]
In my Home then its works but when i use meta() {} as function then it overwrites
@cannap that's a bug - I'll do a little test later to see if I can reproduce it. Thanks!
awesome :D
I have some good news @cannap!
This bug has been fixed - _but_ it's a breaking change. That being said, update to the new version:
$ npm update vue-meta
Then change your metaInfo to look like this:
{
metaInfo () {
title: this.title,
meta: [{ vmid: 'og_sitename', name: 'og_sitename', content: 'Test' }]
}
}
nvm
Actually it seems that I have the same behaviour as @cannap
Is this issue resolved and is there test associated to it @declandewet ?
@Atinux for me is resolved i will try later again and check but for now its just works
@Atinux it _should_ be resolved. However, there are no tests. I do plan on adding test cases for everything, but I have today, tomorrow and Monday to study for a very important exam I'm writing on Tuesday so I will only be adding these tests after then.
In the meantime, post your code here and I'll see if I can spot anything you might be doing wrong :)
I found the bug when vmid is _undefined_, I added the check in #19
So I was not doing anything wrong :)