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

Update titleTemplate

This commit is contained in:
Sébastien Chopin
2017-09-11 12:13:48 +02:00
committed by GitHub
parent bc9d1beb45
commit f8ddeaf6ed
+10 -1
View File
@@ -342,7 +342,7 @@ Maps to the inner-text value of the `<title>` element.
<title>Foo Bar</title>
```
#### `titleTemplate` (String)
#### `titleTemplate` (String | Function)
The value of `title` will be injected into the `%s` placeholder in `titleTemplate` before being rendered. The original title will be available on `metaInfo.titleChunk`.
@@ -359,6 +359,15 @@ The value of `title` will be injected into the `%s` placeholder in `titleTemplat
<title>Foo Bar - Baz</title>
```
The property can also be a function (from [v1.2.0](https://github.com/declandewet/vue-meta/releases/tag/v1.2.0)):
```js
titleTemplate: (titleChunk) => {
// If undefined or blank then we don't need the hyphen
return titleChunk ? `${titleChunk} - Site Title` : 'Site Title';
}
```
#### `htmlAttrs` (Object)
Each **key:value** maps to the equivalent **attribute:value** of the `<html>` element.