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

Allow titleTemplate to be a function

This commit is contained in:
Sean
2017-09-08 12:54:09 -07:00
parent 7484adc70d
commit c3cc4bdae4
+5 -1
View File
@@ -84,7 +84,11 @@ export default function _getMetaInfo (options = {}) {
// replace title with populated template
if (info.titleTemplate) {
info.title = info.titleTemplate.replace(/%s/g, info.titleChunk)
if (typeof info.titleTemplate === 'function') {
info.title = info.titleTemplate(info.titleChunk)
} else {
info.title = info.titleTemplate.replace(/%s/g, info.titleChunk)
}
}
// convert base tag to an array so it can be handled the same way