mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
closes #4587
This commit is contained in:
@@ -9,7 +9,6 @@ var privileges = require('../privileges');
|
||||
var user = require('../user');
|
||||
var categories = require('../categories');
|
||||
var meta = require('../meta');
|
||||
var plugins = require('../plugins');
|
||||
var pagination = require('../pagination');
|
||||
var helpers = require('./helpers');
|
||||
var utils = require('../../public/src/utils');
|
||||
@@ -143,65 +142,63 @@ categoryController.get = function(req, res, callback) {
|
||||
categories.getRecentTopicReplies(allCategories, req.uid, function(err) {
|
||||
next(err, categoryData);
|
||||
});
|
||||
},
|
||||
function (categoryData, next) {
|
||||
categoryData.privileges = userPrivileges;
|
||||
categoryData.showSelect = categoryData.privileges.editable;
|
||||
|
||||
res.locals.metaTags = [
|
||||
{
|
||||
name: 'title',
|
||||
content: categoryData.name
|
||||
},
|
||||
{
|
||||
property: 'og:title',
|
||||
content: categoryData.name
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
content: categoryData.description
|
||||
},
|
||||
{
|
||||
property: "og:type",
|
||||
content: 'website'
|
||||
}
|
||||
];
|
||||
|
||||
if (categoryData.backgroundImage) {
|
||||
res.locals.metaTags.push({
|
||||
name: 'og:image',
|
||||
content: categoryData.backgroundImage
|
||||
});
|
||||
}
|
||||
|
||||
res.locals.linkTags = [
|
||||
{
|
||||
rel: 'alternate',
|
||||
type: 'application/rss+xml',
|
||||
href: nconf.get('url') + '/category/' + cid + '.rss'
|
||||
},
|
||||
{
|
||||
rel: 'up',
|
||||
href: nconf.get('url')
|
||||
}
|
||||
];
|
||||
|
||||
categoryData['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
|
||||
categoryData.rssFeedUrl = nconf.get('relative_path') + '/category/' + categoryData.cid + '.rss';
|
||||
categoryData.title = categoryData.name;
|
||||
categoryData.pagination = pagination.create(currentPage, pageCount);
|
||||
categoryData.pagination.rel.forEach(function(rel) {
|
||||
rel.href = nconf.get('url') + '/category/' + categoryData.slug + rel.href;
|
||||
res.locals.linkTags.push(rel);
|
||||
});
|
||||
|
||||
plugins.fireHook('filter:category.build', {req: req, res: res, templateData: categoryData}, next);
|
||||
}
|
||||
], function (err, data) {
|
||||
], function (err, categoryData) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
res.render('category', data.templateData);
|
||||
|
||||
categoryData.privileges = userPrivileges;
|
||||
categoryData.showSelect = categoryData.privileges.editable;
|
||||
|
||||
res.locals.metaTags = [
|
||||
{
|
||||
name: 'title',
|
||||
content: categoryData.name
|
||||
},
|
||||
{
|
||||
property: 'og:title',
|
||||
content: categoryData.name
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
content: categoryData.description
|
||||
},
|
||||
{
|
||||
property: "og:type",
|
||||
content: 'website'
|
||||
}
|
||||
];
|
||||
|
||||
if (categoryData.backgroundImage) {
|
||||
res.locals.metaTags.push({
|
||||
name: 'og:image',
|
||||
content: categoryData.backgroundImage
|
||||
});
|
||||
}
|
||||
|
||||
res.locals.linkTags = [
|
||||
{
|
||||
rel: 'alternate',
|
||||
type: 'application/rss+xml',
|
||||
href: nconf.get('url') + '/category/' + cid + '.rss'
|
||||
},
|
||||
{
|
||||
rel: 'up',
|
||||
href: nconf.get('url')
|
||||
}
|
||||
];
|
||||
|
||||
categoryData['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
|
||||
categoryData.rssFeedUrl = nconf.get('relative_path') + '/category/' + categoryData.cid + '.rss';
|
||||
categoryData.title = categoryData.name;
|
||||
categoryData.pagination = pagination.create(currentPage, pageCount);
|
||||
categoryData.pagination.rel.forEach(function(rel) {
|
||||
rel.href = nconf.get('url') + '/category/' + categoryData.slug + rel.href;
|
||||
res.locals.linkTags.push(rel);
|
||||
});
|
||||
|
||||
res.render('category', categoryData);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user