diff --git a/README.md b/README.md index 771c1ca..7d7d49f 100644 --- a/README.md +++ b/README.md @@ -342,7 +342,7 @@ Maps to the inner-text value of the `` element. <title>Foo Bar ``` -#### `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 Foo Bar - Baz ``` +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 `` element.