mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: browser title if options.title is undefined
This commit is contained in:
@@ -238,10 +238,11 @@ helpers.buildBreadcrumbs = function (crumbs) {
|
||||
};
|
||||
|
||||
helpers.buildTitle = function (pageTitle) {
|
||||
const titleLayout = meta.config.titleLayout || '{pageTitle} | {browserTitle}';
|
||||
pageTitle = pageTitle || '';
|
||||
const titleLayout = meta.config.titleLayout || `${pageTitle ? '{pageTitle} | ' : ''}{browserTitle}`;
|
||||
|
||||
const browserTitle = validator.escape(String(meta.config.browserTitle || meta.config.title || 'NodeBB'));
|
||||
pageTitle = pageTitle || '';
|
||||
|
||||
const title = titleLayout.replace('{pageTitle}', () => pageTitle).replace('{browserTitle}', () => browserTitle);
|
||||
return title;
|
||||
};
|
||||
|
||||
@@ -162,7 +162,7 @@ module.exports = function (middleware) {
|
||||
|
||||
templateValues.configJSON = jsesc(JSON.stringify(res.locals.config), { isScriptContext: true });
|
||||
|
||||
const title = translator.unescape(utils.stripHTMLTags(options.title));
|
||||
const title = translator.unescape(utils.stripHTMLTags(options.title || ''));
|
||||
const results = await utils.promiseParallel({
|
||||
isAdmin: user.isAdministrator(req.uid),
|
||||
isGlobalMod: user.isGlobalModerator(req.uid),
|
||||
|
||||
Reference in New Issue
Block a user