mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-06 15:42:52 +01:00
closes #3502
This commit is contained in:
@@ -300,6 +300,10 @@ middleware.renderHeader = function(req, res, data, callback) {
|
||||
templateValues.template = {name: res.locals.template};
|
||||
templateValues.template[res.locals.template] = true;
|
||||
|
||||
if (req.route.path === '/') {
|
||||
modifyTitle(templateValues);
|
||||
}
|
||||
|
||||
plugins.fireHook('filter:middleware.renderHeader', {templateValues: templateValues, req: req, res: res}, function(err, data) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -342,6 +346,10 @@ middleware.processRender = function(req, res, next) {
|
||||
}
|
||||
|
||||
if (res.locals.isAPI) {
|
||||
if (req.route.path === '/api/') {
|
||||
options.title = 'Index';
|
||||
}
|
||||
|
||||
return res.json(options);
|
||||
}
|
||||
|
||||
@@ -519,6 +527,21 @@ function redirectToLogin(req, res) {
|
||||
return controllers.helpers.redirect(res, '/login');
|
||||
}
|
||||
|
||||
function modifyTitle(obj) {
|
||||
var title = 'Index | ' + validator.escape(meta.config.title || 'NodeBB');
|
||||
obj.browserTitle = title;
|
||||
|
||||
if (obj.metaTags) {
|
||||
obj.metaTags.forEach(function(tag, i) {
|
||||
if (tag.property === 'og:title') {
|
||||
obj.metaTags[i].content = title;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
module.exports = function(webserver) {
|
||||
app = webserver;
|
||||
middleware.admin = require('./admin')(webserver);
|
||||
|
||||
Reference in New Issue
Block a user