nuxt / vue-meta

Manage HTML metadata in Vue.js components with SSR support
https://vue-meta.nuxtjs.org
Other
4.08k stars 247 forks source link

vue-meta in ssr #802

Open hakimov-dev opened 1 year ago

hakimov-dev commented 1 year ago

image

Someone can explain which app file or folder ?

nicolas-t commented 2 months ago

Depends on you setup, but with vue 2 you likely have a main.js looking like this :

import Vue from 'vue'
import VueMeta from 'vue-meta'

import { createRouter } from './router'
import { createStore } from './store'
import App from './App.vue'

Vue.use(VueMeta)

export function createApp() {
    const router = createRouter()
    const store = createStore()

    const app = new Vue({
        name: 'root',
        render: (el) => el(App),
        router,
        store,
    })

    return {
        app,
        router,
        store,
    }
}

You can then access app like this :

    const { app, router, store } = createApp()
    const meta = app.$meta()