2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-07 20:12:25 +03:00

Merge pull request #294 from ricardogobbosouza/patch-1

docs: add option `headAttrs`
This commit is contained in:
Sébastien Chopin
2018-12-12 16:12:40 +01:00
committed by GitHub
+23 -4
View File
@@ -59,6 +59,7 @@
- [`title` (String)](#title-string)
- [`titleTemplate` (String | Function)](#titletemplate-string--function)
- [`htmlAttrs` (Object)](#htmlattrs-object)
- [`headAttrs` (Object)](#headattrs-object)
- [`bodyAttrs` (Object)](#bodyattrs-object)
- [`base` (Object)](#base-object)
- [`meta` ([Object])](#meta-object)
@@ -190,12 +191,12 @@ app.get('*', (req, res) => {
if (error) return res.send(error.stack)
const bodyOpt = { body: true }
const {
title, htmlAttrs, bodyAttrs, link, style, script, noscript, meta
title, htmlAttrs, headAttrs, bodyAttrs, link, style, script, noscript, meta
} = context.meta.inject()
return res.send(`
<!doctype html>
<html data-vue-meta-server-rendered ${htmlAttrs.text()}>
<head>
<head ${headAttrs.text()}>
${meta.text()}
${title.text()}
${link.text()}
@@ -238,12 +239,12 @@ app.get('*', (req, res) => {
renderStream.once('data', () => {
const bodyOpt = { body: true }
const {
title, htmlAttrs, bodyAttrs, link, style, script, noscript, meta
title, htmlAttrs, headAttrs, bodyAttrs, link, style, script, noscript, meta
} = context.meta.inject()
res.write(`
<!doctype html>
<html data-vue-meta-server-rendered ${htmlAttrs.text()}>
<head>
<head ${headAttrs.text()}>
${meta.text()}
${title.text()}
${link.text()}
@@ -397,6 +398,24 @@ Each **key:value** maps to the equivalent **attribute:value** of the `<html>` el
<html foo="bar" amp></html>
```
#### `headAttrs` (Object)
Each **key:value** maps to the equivalent **attribute:value** of the `<head>` element.
```js
{
metaInfo: {
headAttrs: {
foo: 'bar'
}
}
}
```
```html
<head foo="bar"></head>
```
#### `bodyAttrs` (Object)
Each **key:value** maps to the equivalent **attribute:value** of the `<body>` element.