57949d7c15fc9f285780608c1ebdf0c040265ca37a1f5ece1e8027199bf83caf7a3329ecdfea3f3494c27fa4559cd6b0c8046be25c37b8f0bd81d143a9cc41 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <p align="center">
  2. <img src="./docs/.vuepress/public/vue-meta.png" alt="vue-meta" />
  3. </p>
  4. <h5 align="center">
  5. Manage HTML metadata in Vue.js components with SSR support
  6. </h5>
  7. <p align="center">
  8. <a href="http://npm-stat.com/charts.html?package=vue-meta"><img src="https://img.shields.io/npm/dm/vue-meta.svg" alt="npm downloads"></a>
  9. <a href="http://npmjs.org/package/vue-meta"><img src="https://img.shields.io/npm/v/vue-meta.svg" alt="npm version"></a>
  10. <a href="https://codecov.io/gh/nuxt/vue-meta"><img src="https://badgen.net/codecov/c/github/nuxt/vue-meta/master" alt="Coverage Status"></a>
  11. <a href="https://circleci.com/gh/nuxt/vue-meta/"><img src="https://badgen.net/circleci/github/nuxt/vue-meta" alt="Build Status"></a>
  12. <a href="https://david-dm.org/nuxt/vue-meta"><img src="https://david-dm.org/nuxt/vue-meta/status.svg" alt="dependencies Status"></a>
  13. <a href="https://discord.nuxtjs.org/"><img src="https://badgen.net/badge/Discord/join-us/7289DA" alt="Discord"></a>
  14. </p>
  15. ```html
  16. <template>
  17. ...
  18. </template>
  19. <script>
  20. export default {
  21. metaInfo: {
  22. title: 'My Example App',
  23. titleTemplate: '%s - Yay!',
  24. htmlAttrs: {
  25. lang: 'en',
  26. amp: true
  27. }
  28. }
  29. }
  30. </script>
  31. ```
  32. ```html
  33. <html lang="en" amp>
  34. <head>
  35. <title>My Example App - Yay!</title>
  36. ...
  37. </head>
  38. ```
  39. # Introduction
  40. Vue Meta is a [Vue.js](https://vuejs.org) plugin that allows you to manage your app's metadata. It is inspired by and works similar as [`react-helmet`](https://github.com/nfl/react-helmet) 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.
  41. 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 metadata directly to deeply nested subcomponents for more maintainable code.
  42. ## Documentation
  43. Please find the documention on https://vue-meta.nuxtjs.org
  44. > :globe_with_meridians: Please help us translate the documentation into your language, see [here](#how-to-translate-documentation) for more information
  45. ## Examples
  46. Looking for more examples what vue-meta can do for you? Have a look at the [examples](https://github.com/nuxt/vue-meta/tree/master/examples)
  47. ## Installation
  48. ##### Yarn
  49. ```sh
  50. $ yarn add vue-meta
  51. ```
  52. ##### npm
  53. ```sh
  54. $ npm install vue-meta --save
  55. ```
  56. ##### Download / CDN
  57. Use the download links below - if you want a previous version, check the instructions at https://unpkg.com.
  58. Latest version: https://unpkg.com/vue-meta/dist/vue-meta.min.js
  59. Latest v1.x version: https://unpkg.com/vue-meta@1/dist/vue-meta.min.js
  60. **Uncompressed:**
  61. ```html
  62. <script src="https://unpkg.com/vue-meta/dist/vue-meta.js"></script>
  63. ```
  64. **Minified:**
  65. ```html
  66. <script src="https://unpkg.com/vue-meta/dist/vue-meta.min.js"></script>
  67. ```
  68. ## Quick Usage
  69. See the [documentation](https://vue-meta.nuxtjs.org) for more information
  70. ```js
  71. import Vue from 'vue'
  72. import VueMeta from 'vue-meta'
  73. Vue.use(VueMeta, {
  74. // optional pluginOptions
  75. refreshOnceOnNavigation: true
  76. })
  77. ```
  78. ## Frameworks using vue-meta
  79. If you wish to create your app even more quickly, take a look at the following frameworks which use vue-meta
  80. - [Nuxt.js](https://github.com/nuxt/nuxt.js) - The Vue.js Progressive Framework
  81. - [Gridsome](https://github.com/gridsome/gridsome) - The Vue.js JAMstack Framework
  82. - [Ream](https://github.com/ream/ream) - Framework for building universal web app and static website in Vue.js
  83. - [Vue-Storefront](https://github.com/DivanteLtd/vue-storefront) - PWA for eCommerce
  84. - [Factor JS](https://github.com/fiction-com/factor) - Extension-first VueJS platform for front-end developers.
  85. ## How to translate documentation
  86. Thanks for your interest in translating the documentation. As our docs are based on VuePress, we recommend to have a look at their docs about [internationalization](https://vuepress.vuejs.org/guide/i18n.html#site-level-i18n-config) as well
  87. Here are the steps you will need to take:
  88. - Clone this repository
  89. - Create a new branch
  90. - Browse to `/docs/`
  91. - Create a folder with the language code you will add a translation for (eg `/zh/`)
  92. - Copy all `*.md` files and the folders `api`, `faq`, and `guide` to that folder
  93. - Translate the copied files in your language folder
  94. - Edit `.vuepress/config.yml` and add a config section for your locale in both `locales` as `themeConfig.locales`
  95. - Test your translation by running the docs dev server with `yarn docs`
  96. - Create a pull request with your changes
  97. - Receive eternal gratefulness from your fellow language speakers :heart:
  98. ## Old versions
  99. Click [here](https://github.com/nuxt/vue-meta/tree/1.x) if you are looking for the old v1 readme
  100. ## License
  101. [MIT](./LICENSE.md)