mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-24 11:00:34 +03:00
+1
-1
@@ -12,7 +12,7 @@ node_js:
|
|||||||
before_install:
|
before_install:
|
||||||
- npm i -g yarn --cache-min 999999999
|
- npm i -g yarn --cache-min 999999999
|
||||||
install:
|
install:
|
||||||
- yarn
|
- yarn --force
|
||||||
script:
|
script:
|
||||||
- yarn test
|
- yarn test
|
||||||
after_script:
|
after_script:
|
||||||
|
|||||||
@@ -81,6 +81,7 @@
|
|||||||
|
|
||||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||||
|
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
`vue-meta` is a [Vue 2.0](https://vuejs.org) plugin that allows you to manage your app's meta information, much like [`react-helmet`](https://github.com/nfl/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.
|
`vue-meta` is a [Vue 2.0](https://vuejs.org) plugin that allows you to manage your app's meta information, much like [`react-helmet`](https://github.com/nfl/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.
|
||||||
|
|
||||||
@@ -192,7 +193,7 @@ app.get('*', (req, res) => {
|
|||||||
const context = { url: req.url }
|
const context = { url: req.url }
|
||||||
renderer.renderToString(context, (error, html) => {
|
renderer.renderToString(context, (error, html) => {
|
||||||
if (error) return res.send(error.stack)
|
if (error) return res.send(error.stack)
|
||||||
const {
|
const {
|
||||||
title, htmlAttrs, bodyAttrs, link, style, script, noscript, meta
|
title, htmlAttrs, bodyAttrs, link, style, script, noscript, meta
|
||||||
} = context.meta.inject()
|
} = context.meta.inject()
|
||||||
return res.send(`
|
return res.send(`
|
||||||
@@ -385,7 +386,7 @@ Each **key:value** maps to the equivalent **attribute:value** of the `<body>` el
|
|||||||
{
|
{
|
||||||
metaInfo: {
|
metaInfo: {
|
||||||
bodyAttrs: {
|
bodyAttrs: {
|
||||||
bar: 'baz'
|
bar: 'baz'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -397,7 +398,7 @@ Each **key:value** maps to the equivalent **attribute:value** of the `<body>` el
|
|||||||
|
|
||||||
#### `base` (Object)
|
#### `base` (Object)
|
||||||
|
|
||||||
Maps to a newly-created `<base>` element, where object properties map to attributes.
|
Maps to a newly-created `<base>` element, where object properties map to attributes.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
@@ -413,7 +414,7 @@ Maps to a newly-created `<base>` element, where object properties map to attribu
|
|||||||
|
|
||||||
#### `meta` ([Object])
|
#### `meta` ([Object])
|
||||||
|
|
||||||
Each item in the array maps to a newly-created `<meta>` element, where object properties map to attributes.
|
Each item in the array maps to a newly-created `<meta>` element, where object properties map to attributes.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
@@ -433,7 +434,7 @@ Each item in the array maps to a newly-created `<meta>` element, where object pr
|
|||||||
|
|
||||||
#### `link` ([Object])
|
#### `link` ([Object])
|
||||||
|
|
||||||
Each item in the array maps to a newly-created `<link>` element, where object properties map to attributes.
|
Each item in the array maps to a newly-created `<link>` element, where object properties map to attributes.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
@@ -453,7 +454,7 @@ Each item in the array maps to a newly-created `<link>` element, where object pr
|
|||||||
|
|
||||||
#### `style` ([Object])
|
#### `style` ([Object])
|
||||||
|
|
||||||
Each item in the array maps to a newly-created `<style>` element, where object properties map to attributes.
|
Each item in the array maps to a newly-created `<style>` element, where object properties map to attributes.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
@@ -471,7 +472,7 @@ Each item in the array maps to a newly-created `<style>` element, where object p
|
|||||||
|
|
||||||
#### `script` ([Object])
|
#### `script` ([Object])
|
||||||
|
|
||||||
Each item in the array maps to a newly-created `<script>` element, where object properties map to attributes.
|
Each item in the array maps to a newly-created `<script>` element, where object properties map to attributes.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
@@ -489,7 +490,7 @@ Each item in the array maps to a newly-created `<script>` element, where object
|
|||||||
|
|
||||||
#### `noscript` ([Object])
|
#### `noscript` ([Object])
|
||||||
|
|
||||||
Each item in the array maps to a newly-created `<noscript>` element, where object properties map to attributes.
|
Each item in the array maps to a newly-created `<noscript>` element, where object properties map to attributes.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
@@ -686,7 +687,7 @@ Easy. Instead of defining `metaInfo` as an object, define it as a function and a
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Post from './Post.vue'
|
import Post from './Post.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'post-container',
|
name: 'post-container',
|
||||||
components: { Post },
|
components: { Post },
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@
|
|||||||
"karma-coverage": "^1.1.1",
|
"karma-coverage": "^1.1.1",
|
||||||
"karma-mocha": "^1.2.0",
|
"karma-mocha": "^1.2.0",
|
||||||
"karma-mocha-reporter": "^2.2.0",
|
"karma-mocha-reporter": "^2.2.0",
|
||||||
"karma-phantomjs-launcher": "^1.0.2",
|
"karma-phantomjs-launcher": "^1.0.4",
|
||||||
"karma-sourcemap-loader": "^0.3.7",
|
"karma-sourcemap-loader": "^0.3.7",
|
||||||
"karma-webpack": "^2.0.2",
|
"karma-webpack": "^2.0.2",
|
||||||
"mocha": "^3.1.2",
|
"mocha": "^3.1.2",
|
||||||
|
|||||||
Reference in New Issue
Block a user