mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
category teaser
This commit is contained in:
@@ -65,6 +65,15 @@ categoriesController.list = function(req, res, next) {
|
|||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.categories.forEach(function(category) {
|
||||||
|
if (category && Array.isArray(category.posts) && category.posts.length) {
|
||||||
|
category.teaser = {
|
||||||
|
url: nconf.get('relative_path') + '/topic/' + category.posts[0].topic.slug + '/' + category.posts[0].index,
|
||||||
|
timestampISO: category.posts[0].relativeTime
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
data.title = '[[pages:categories]]';
|
data.title = '[[pages:categories]]';
|
||||||
if (req.path.startsWith('/api/categories') || req.path.startsWith('/categories')) {
|
if (req.path.startsWith('/api/categories') || req.path.startsWith('/categories')) {
|
||||||
data.breadcrumbs = helpers.buildBreadcrumbs([{text: data.title}]);
|
data.breadcrumbs = helpers.buildBreadcrumbs([{text: data.title}]);
|
||||||
|
|||||||
Reference in New Issue
Block a user