From c3cc4bdae4132770e6bf42b730e38508a694df3e Mon Sep 17 00:00:00 2001 From: Sean Date: Fri, 8 Sep 2017 12:54:09 -0700 Subject: [PATCH] Allow titleTemplate to be a function --- src/shared/getMetaInfo.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shared/getMetaInfo.js b/src/shared/getMetaInfo.js index 284b703..db37a76 100644 --- a/src/shared/getMetaInfo.js +++ b/src/shared/getMetaInfo.js @@ -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