How to use vue-meta - 4 common examples

To help you get started, we’ve selected a few vue-meta examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nuxt / nuxt.js / packages / vue-renderer / src / renderers / spa.js View on Github external
BODY_ATTRS: '',
      HEAD: '',
      BODY_SCRIPTS_PREPEND: '',
      BODY_SCRIPTS: ''
    }

    if (this.options.features.meta) {
      // Get vue-meta context
      let head
      if (typeof this.options.head === 'function') {
        head = this.options.head()
      } else {
        head = cloneDeep(this.options.head)
      }

      const m = VueMeta.generate(head || {}, this.vueMetaConfig)

      // HTML_ATTRS
      meta.HTML_ATTRS = m.htmlAttrs.text()

      // HEAD_ATTRS
      meta.HEAD_ATTRS = m.headAttrs.text()

      // BODY_ATTRS
      meta.BODY_ATTRS = m.bodyAttrs.text()

      // HEAD tags
      meta.HEAD =
        m.title.text() +
        m.meta.text() +
        m.link.text() +
        m.style.text() +
github nuxt-community / nuxt-i18n / src / templates / seo-head.js View on Github external
export const nuxtI18nSeo = function () {
  const COMPONENT_OPTIONS_KEY = '<%= options.COMPONENT_OPTIONS_KEY %>'
  if (
    !(VueMeta.hasMetaInfo ? VueMeta.hasMetaInfo(this) : this._hasMetaInfo) ||
    !this.$i18n ||
    !this.$i18n.locale ||
    !this.$i18n.locales ||
    this.$options[COMPONENT_OPTIONS_KEY] === false ||
    (this.$options[COMPONENT_OPTIONS_KEY] && this.$options[COMPONENT_OPTIONS_KEY].seo === false)
  ) {
    return {};
  }
  const LOCALE_CODE_KEY = '<%= options.LOCALE_CODE_KEY %>'
  const LOCALE_ISO_KEY = '<%= options.LOCALE_ISO_KEY %>'
  const BASE_URL = '<%= options.baseUrl %>'
  const STRATEGY = '<%= options.strategy %>'

  // Prepare html lang attribute
  const currentLocaleData = this.$i18n.locales.find(l => l[LOCALE_CODE_KEY] === this.$i18n.locale)
  const htmlAttrs = {}
github nuxt-community / amp-module / lib / amp / plugin.js View on Github external
import VueMeta from 'vue-meta'
import './components'

const [vueMetaMajor] = VueMeta.version.split('.')

function ensureKey (obj, key, d) {
  if (!obj[key]) {
    obj[key] = d
  }
}

function pick (...args) {
  for (const arg of args) {
    if (arg !== undefined) {
      return arg
    }
  }
}

export default function (ctx, inject) {
github nuxt-community / amp-module / lib / amp / middleware.js View on Github external
import VueMeta from 'vue-meta'
import { stringify } from 'qs'
import Middleware from '../middleware'

const [vueMetaMajor] = VueMeta.version.split('.')

function ensureKey (obj, key, d) {
  if (!obj[key]) {
    obj[key] = d
  }
}

function stringifyQuery (query) {
  if (!Object.keys(query).length) {
    return ''
  }
  return '?' + stringify(query)
}

Middleware.amp = function ({ route, req, app }) {
  if (!route.matched[0]) {

vue-meta

Manage HTML metadata in Vue.js components with ssr support

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis