mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-24 01:00:33 +03:00
Update README.md
This commit is contained in:
committed by
GitHub
parent
8971e9c6da
commit
53d6f820aa
@@ -59,6 +59,7 @@
|
|||||||
- [`title` (String)](#title-string)
|
- [`title` (String)](#title-string)
|
||||||
- [`titleTemplate` (String | Function)](#titletemplate-string--function)
|
- [`titleTemplate` (String | Function)](#titletemplate-string--function)
|
||||||
- [`htmlAttrs` (Object)](#htmlattrs-object)
|
- [`htmlAttrs` (Object)](#htmlattrs-object)
|
||||||
|
- [`headAttrs` (Object)](#headattrs-object)
|
||||||
- [`bodyAttrs` (Object)](#bodyattrs-object)
|
- [`bodyAttrs` (Object)](#bodyattrs-object)
|
||||||
- [`base` (Object)](#base-object)
|
- [`base` (Object)](#base-object)
|
||||||
- [`meta` ([Object])](#meta-object)
|
- [`meta` ([Object])](#meta-object)
|
||||||
@@ -190,12 +191,12 @@ app.get('*', (req, res) => {
|
|||||||
if (error) return res.send(error.stack)
|
if (error) return res.send(error.stack)
|
||||||
const bodyOpt = { body: true }
|
const bodyOpt = { body: true }
|
||||||
const {
|
const {
|
||||||
title, htmlAttrs, bodyAttrs, link, style, script, noscript, meta
|
title, htmlAttrs, headAttrs, bodyAttrs, link, style, script, noscript, meta
|
||||||
} = context.meta.inject()
|
} = context.meta.inject()
|
||||||
return res.send(`
|
return res.send(`
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html data-vue-meta-server-rendered ${htmlAttrs.text()}>
|
<html data-vue-meta-server-rendered ${htmlAttrs.text()}>
|
||||||
<head>
|
<head ${headAttrs.text()}>
|
||||||
${meta.text()}
|
${meta.text()}
|
||||||
${title.text()}
|
${title.text()}
|
||||||
${link.text()}
|
${link.text()}
|
||||||
@@ -238,12 +239,12 @@ app.get('*', (req, res) => {
|
|||||||
renderStream.once('data', () => {
|
renderStream.once('data', () => {
|
||||||
const bodyOpt = { body: true }
|
const bodyOpt = { body: true }
|
||||||
const {
|
const {
|
||||||
title, htmlAttrs, bodyAttrs, link, style, script, noscript, meta
|
title, htmlAttrs, headAttrs, bodyAttrs, link, style, script, noscript, meta
|
||||||
} = context.meta.inject()
|
} = context.meta.inject()
|
||||||
res.write(`
|
res.write(`
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html data-vue-meta-server-rendered ${htmlAttrs.text()}>
|
<html data-vue-meta-server-rendered ${htmlAttrs.text()}>
|
||||||
<head>
|
<head ${headAttrs.text()}>
|
||||||
${meta.text()}
|
${meta.text()}
|
||||||
${title.text()}
|
${title.text()}
|
||||||
${link.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>
|
<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)
|
#### `bodyAttrs` (Object)
|
||||||
|
|
||||||
Each **key:value** maps to the equivalent **attribute:value** of the `<body>` element.
|
Each **key:value** maps to the equivalent **attribute:value** of the `<body>` element.
|
||||||
|
|||||||
Reference in New Issue
Block a user