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

support title template

This commit is contained in:
Declan de Wet
2016-10-30 09:43:44 +02:00
parent d514cdc1bc
commit 8c43f47d64
+7 -1
View File
@@ -32,6 +32,7 @@
// define API methods on the `$vueMeta` instance property
Object.defineProperty(Vue.prototype, '$vueMeta', {
enumerable: true,
/**
* Meta info manager API factory
* @return {Object} - the API for this plugin
@@ -59,7 +60,11 @@
* @return {Object} - all the meta info for currently matched components
*/
function getMetaInfo () {
return getMetaInfoDefinition(Vue, this)
var info = getMetaInfoDefinition(Vue, this)
if (info.titleTemplate) {
info.title = info.titleTemplate.replace('%s', info.title)
}
return info
}
}
@@ -111,6 +116,7 @@
}
}
// meta info is ready for consumption
return metaInfo
}