fix title in acp removed extra |

v1.18.x
barisusakli 9 years ago
parent 933a89d2ae
commit 4e2318fa1e

@ -291,6 +291,9 @@ app.cacheBuster = null;
};
app.refreshTitle = function(title) {
if (!title) {
return;
}
require(['translator'], function(translator) {
title = config.titleLayout.replace(/{/g, '{').replace(/}/g, '}').replace('{pageTitle}', title).replace('{browserTitle}', config.browserTitle);
translator.translate(title, function(translated) {

@ -34,7 +34,7 @@ apiController.getConfig = function(req, res, next) {
config.version = nconf.get('version');
config.siteTitle = validator.escape(meta.config.title || meta.config.browserTitle || 'NodeBB');
config.browserTitle = validator.escape(meta.config.browserTitle || meta.config.title || 'NodeBB');
config.titleLayout = (meta.config.titleLayout || '{pageTitle} || {browserTitle}').replace(/{/g, '{').replace(/}/g, '}');
config.titleLayout = (meta.config.titleLayout || '{pageTitle} | {browserTitle}').replace(/{/g, '{').replace(/}/g, '}');
config.showSiteTitle = parseInt(meta.config.showSiteTitle, 10) === 1;
config.postDelay = meta.config.postDelay;
config.minimumTitleLength = meta.config.minimumTitleLength;

@ -100,4 +100,13 @@ helpers.buildBreadcrumbs = function(crumbs) {
return breadcrumbs;
};
helpers.buildTitle = function(pageTitle) {
var titleLayout = meta.config.titleLayout || '{pageTitle} | {browserTitle}';
var browserTitle = validator.escape(meta.config.browserTitle || meta.config.title || 'NodeBB');
pageTitle = pageTitle || '';
var title = titleLayout.replace('{pageTitle}', pageTitle).replace('{browserTitle}', browserTitle);
return title;
};
module.exports = helpers;

@ -237,7 +237,7 @@ middleware.renderHeader = function(req, res, data, callback) {
}
},
title: function(next) {
next(null, buildTitle(data.title));
next(null, controllers.helpers.buildTitle(data.title));
},
isAdmin: function(next) {
user.isAdministrator(req.uid, next);
@ -454,17 +454,10 @@ function redirectToLogin(req, res) {
return controllers.helpers.redirect(res, '/login');
}
function buildTitle(pageTitle) {
var titleLayout = meta.config.titleLayout || '{pageTitle} | {browserTitle}';
var browserTitle = validator.escape(meta.config.browserTitle || meta.config.title || 'NodeBB');
pageTitle = pageTitle || '';
var title = titleLayout.replace('{pageTitle}', pageTitle).replace('{browserTitle}', browserTitle);
return title;
}
function modifyTitle(obj) {
var title = buildTitle('[[pages:home]]');
var title = controllers.helpers.buildTitle('[[pages:home]]');
obj.browserTitle = title;
if (obj.metaTags) {

Loading…
Cancel
Save