mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	closes #3547
This commit is contained in:
		| @@ -292,8 +292,8 @@ app.cacheBuster = null; | ||||
|  | ||||
| 	app.refreshTitle = function(title) { | ||||
| 		require(['translator'], function(translator) { | ||||
| 			title = config.titleLayout.replace(/{/g, '{').replace(/}/g, '}').replace('{pageTitle}', title).replace('{browserTitle}', config.browserTitle); | ||||
| 			translator.translate(title, function(translated) { | ||||
| 				translated = translated ? (translated + ' | ' + config.browserTitle) : config.browserTitle; | ||||
| 				titleObj.titles[0] = translated; | ||||
| 				app.alternatingTitle(''); | ||||
| 			}); | ||||
|   | ||||
| @@ -34,6 +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.showSiteTitle = parseInt(meta.config.showSiteTitle, 10) === 1; | ||||
| 	config.postDelay = meta.config.postDelay; | ||||
| 	config.minimumTitleLength = meta.config.minimumTitleLength; | ||||
|   | ||||
| @@ -237,9 +237,7 @@ middleware.renderHeader = function(req, res, data, callback) { | ||||
| 			} | ||||
| 		}, | ||||
| 		title: function(next) { | ||||
| 			var title = validator.escape(meta.config.browserTitle || meta.config.title || 'NodeBB'); | ||||
| 			title = data.title ? (data.title + ' | ' + title) : title; | ||||
| 			next(null, title); | ||||
| 			next(null, buildTitle(data.title)); | ||||
| 		}, | ||||
| 		isAdmin: function(next) { | ||||
| 			user.isAdministrator(req.uid, next); | ||||
| @@ -456,8 +454,17 @@ 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 = '[[pages:home]] | ' + validator.escape(meta.config.browserTitle || meta.config.title || 'NodeBB'); | ||||
| 	var title = buildTitle('[[pages:home]]'); | ||||
| 	obj.browserTitle = title; | ||||
|  | ||||
| 	if (obj.metaTags) { | ||||
|   | ||||
| @@ -22,6 +22,12 @@ | ||||
| 				If no browser title is specified, the site title will be used | ||||
| 			</p> | ||||
|  | ||||
| 			<label>Title Layout</label> | ||||
| 			<input class="form-control" type="text" placeholder="Title Layout" data-field="titleLayout" /> | ||||
| 			<p class="help-block"> | ||||
| 				Define how the browser title will be structured ie. {pageTitle} | {browserTitle} | ||||
| 			</p> | ||||
|  | ||||
| 			<label>Site Description</label> | ||||
| 			<input type="text" class="form-control" placeholder="A short description about your community" data-field="description" /><br /> | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user