vue-meta
vue-meta copied to clipboard
Vue meta Alpha8 doens't generate meta tags properly
Hi I'm using Vue3 with vue-meta: ^3.0.0-alpha.8
. I'm trying to setup my project in order to set dynamically the meta-tags.
Here my code on App.vue
:
import constants from './constants'
export default {
data() {
return {
constants: constants
}
}
},
setup() {
useMeta({
htmlAttrs: {
lang: constants.meta.language,
},
description: constants.main.description,
meta: [
{
name: 'author',
content: constants.meta.author
},
{
name: 'keywords',
content: constants.meta.keywords
},
{
name: 'robots',
content: constants.meta.robots
}
]
}
}
}
htmlAttrs
and description
works fine generating: <html lang="en" ...
and <meta name="description" content="My description">
The other tags, on the other hand, are generated incorrectly:
<meta name="meta" content="my author string">
<meta name="meta" content="my keywords string">
<meta name="meta" content="my robots string">
Why it is generating <meta name="meta" ..
instead of <meta name="MY PARAMETER NAME" ..
?
Having the same issue, using the property as name works through.
Having the same issue
Having the same issue, using the property as name works through.
What do you mean with: using the property as name works through?
3.0.0-alpha.10 has same issue
Same issue.
Having the same issue, using the property as name works through.
What do you mean with: using the property as name works through?
property="name" seems to work fine
Having the same issue. Has anyone found a solution? I am using the alpha.10 version.
I found a method that works, although it seems odd.
//import
import {createMetaManager, defaultConfig} from 'vue-meta'
//createApp setting
const metaManager = createMetaManager(!!import.meta.env.SSR, {
...defaultConfig,
...{
'applicable-device': {
tag: 'meta',
keyAttribute: 'name',
valueAttribute: 'content'
},
}
})
app.use(metaManager);
// use
useMeta({
'applicable-device': "pc",
})
result >>> <meta name="applicable-device" content="pc">
Well some how this will fix the issue. I think it overwrites it. meta: [{ name: 'robots', Name: 'robots', content: 'noindex,nofollow' }],