The head property

Nuxt let you define all default meta for your application inside nuxt.config.js, use the same head property


  • Type: Object or Function

nuxt.config.js

  1. export default {
  2. head: {
  3. titleTemplate: '%s - Nuxt',
  4. meta: [
  5. { charset: 'utf-8' },
  6. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  7. // hid is used as unique identifier. Do not use `vmid` for it as it will not work
  8. { hid: 'description', name: 'description', content: 'Meta description' }
  9. ]
  10. }
  11. }

To know the list of options you can give to head, take a look at vue-meta documentation.

You can also use head as a function in your components to access the component data through this (read more).

The head Property - 图1

To avoid duplicated meta tags when used in child component, set up a unique identifier with the hid key for your meta elements (read more).