Questions tagged [vue-meta]

Vue Meta allows you to manage the meta information for a Vue application.

vue-meta is a Vue 2.0 plugin that allows you to manage your app's meta information, much like react-helmet does for React. However, instead of setting your data as props passed to a proprietary component, you simply export it as part of your component's data using the metaInfo property.

These properties, when set on a deeply nested component, will cleverly overwrite their parent components' metaInfo, thereby enabling custom info for each top-level view as well as coupling meta info directly to deeply nested subcomponents for more maintainable code.

Installation

Yarn

yarn add vue-meta

NPM

npm install vue-meta --save

Please read the usage documentation for more information on how to set up this plugin.

Usage

Simply add the meta info field to any component. The most nested component will override the meta information for the page. Please read the usage documentation for more information including setup steps.

<template>
  ...
</template>

<script>
  export default {
    metaInfo: {
      title: 'My Example App', // set a title
      titleTemplate: '%s - Yay!', // title is now "My Example App - Yay!"
      htmlAttrs: {
        lang: 'en',
        amp: undefined // "amp" has no value
      }
    }
  }
</script>

Links

72 questions
53
votes
3 answers

How to set lang attribute on html element with Nuxt?

Using the file nuxt.config.js file, head contents can be customized to add some meta, or other things: module.exports = { /* ** Headers of the page */ head: { title: 'awesome title', meta: [ { charset: 'utf-8' }, { name:…
rocambille
  • 15,398
  • 12
  • 50
  • 68
21
votes
3 answers

How to use Vue 3 Meta with Vue.js 3?

It seems that Vue Meta has been upgraded to handle Vue.js 3 with a new npm package called vue-3-meta Before Vue.js 3, it was easy to use vue-meta by adding it to the Vue instance: import Vue from 'vue' import VueMeta from 'vue-meta' …
volume one
  • 6,800
  • 13
  • 67
  • 146
19
votes
4 answers

Vue meta not getting updates

When I visit my internal pages vue-meta will not get updated by new page values. Code app.js import VueMeta from 'vue-meta' Vue.use(VueMeta, { refreshOnceOnNavigation: true }) App.vue (main component) export default { metaInfo() { return…
mafortis
  • 6,750
  • 23
  • 130
  • 288
14
votes
1 answer

Vue-meta: metaInfo doesn't have an access to computed properties

I'm using vue-meta to dynamically change my meta tags. I want to change it only on some particular pages. I'm using metaInfo function and try to change, for example, a title. But data from my getter is undefined which is why I cannot change the…
Olga B
  • 513
  • 2
  • 11
  • 34
6
votes
2 answers

How can I access HEAD data in component with nuxt?

In a page, I set head title like this: ... How can I get this data in another component? I tried with this.$metaInfo but my component where I need…
ManUtopiK
  • 4,495
  • 3
  • 38
  • 52
6
votes
1 answer

Inline Js with Vue-Meta In Nuxt.js

Basically, Im using Nuxt 2.9.2, and trying to using innerHTML method to inline a Google Optimize script, but whenever i run npm run generate, the code transforms certain aspects even though __dangerouslyDisableSanitizers is whitelisting…
Aihsan Majeed
  • 135
  • 1
  • 11
6
votes
0 answers

Dynamic Meta tags in Vue (Open Graph)

I have a Vue.js application where I want to use Open Graph Meta Tags to display some content (title, description, image) when a link is shared on social media (mainly facebook). I use vue-meta to display the title where I use the title template, and…
5
votes
2 answers

Vue-meta: Cannot set property '$meta' of undefined

After installing vue-meta, there is an error in my browser console. Why is this error showing up? Is it from my code or a bug? I am using vue-meta@2.4.0 and Vue 3. main.js createApp(App) .use(router) .use(VueMeta) …
Fatoni
  • 509
  • 1
  • 6
  • 10
5
votes
4 answers

Vue application meta tags for social sharing

I have developed a Vue app that has navigation and content on each page. What i need is to setup meta tags for each different page for Twitter and Facebook cards. For that i use vue-meta library and I have come up with the following code: metaInfo()…
myoda999
  • 335
  • 2
  • 11
4
votes
1 answer

Dynamic title in Vue3 with vue-meta composition API

I am trying to get a dynamic title for useMeta with composition API but it does not work.