mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
fix title in acp removed extra |
This commit is contained in:
@@ -291,6 +291,9 @@ app.cacheBuster = null;
|
|||||||
};
|
};
|
||||||
|
|
||||||
app.refreshTitle = function(title) {
|
app.refreshTitle = function(title) {
|
||||||
|
if (!title) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
require(['translator'], function(translator) {
|
require(['translator'], function(translator) {
|
||||||
title = config.titleLayout.replace(/{/g, '{').replace(/}/g, '}').replace('{pageTitle}', title).replace('{browserTitle}', config.browserTitle);
|
title = config.titleLayout.replace(/{/g, '{').replace(/}/g, '}').replace('{pageTitle}', title).replace('{browserTitle}', config.browserTitle);
|
||||||
translator.translate(title, function(translated) {
|
translator.translate(title, function(translated) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ apiController.getConfig = function(req, res, next) {
|
|||||||
config.version = nconf.get('version');
|
config.version = nconf.get('version');
|
||||||
config.siteTitle = validator.escape(meta.config.title || meta.config.browserTitle || 'NodeBB');
|
config.siteTitle = validator.escape(meta.config.title || meta.config.browserTitle || 'NodeBB');
|
||||||
config.browserTitle = validator.escape(meta.config.browserTitle || meta.config.title || '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.showSiteTitle = parseInt(meta.config.showSiteTitle, 10) === 1;
|
||||||
config.postDelay = meta.config.postDelay;
|
config.postDelay = meta.config.postDelay;
|
||||||
config.minimumTitleLength = meta.config.minimumTitleLength;
|
config.minimumTitleLength = meta.config.minimumTitleLength;
|
||||||
|
|||||||
@@ -100,4 +100,13 @@ helpers.buildBreadcrumbs = function(crumbs) {
|
|||||||
return breadcrumbs;
|
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;
|
module.exports = helpers;
|
||||||
@@ -237,7 +237,7 @@ middleware.renderHeader = function(req, res, data, callback) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
title: function(next) {
|
title: function(next) {
|
||||||
next(null, buildTitle(data.title));
|
next(null, controllers.helpers.buildTitle(data.title));
|
||||||
},
|
},
|
||||||
isAdmin: function(next) {
|
isAdmin: function(next) {
|
||||||
user.isAdministrator(req.uid, next);
|
user.isAdministrator(req.uid, next);
|
||||||
@@ -454,17 +454,10 @@ function redirectToLogin(req, res) {
|
|||||||
return controllers.helpers.redirect(res, '/login');
|
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) {
|
function modifyTitle(obj) {
|
||||||
var title = buildTitle('[[pages:home]]');
|
var title = controllers.helpers.buildTitle('[[pages:home]]');
|
||||||
obj.browserTitle = title;
|
obj.browserTitle = title;
|
||||||
|
|
||||||
if (obj.metaTags) {
|
if (obj.metaTags) {
|
||||||
|
|||||||
Reference in New Issue
Block a user