mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-26 17:29:53 +01:00
refactors to sitemap, closed #2254
This commit is contained in:
@@ -54,34 +54,34 @@ var path = require('path'),
|
||||
topicUrls: function(next) {
|
||||
var topicUrls = [];
|
||||
|
||||
db.getSortedSetRevRange('topics:recent', 0, 49, function(err, tids) {
|
||||
async.waterfall([
|
||||
async.apply(db.getSortedSetRevRange, 'topics:recent', 0, -1),
|
||||
function(tids, next) {
|
||||
db.getSortedSetRevRange('topics:recent', 0, -1, next);
|
||||
},
|
||||
function(tids, next) {
|
||||
privileges.topics.filter('read', tids, 0, next);
|
||||
},
|
||||
function(tids, next) {
|
||||
topics.getTopicsFields(tids, ['tid', 'title', 'lastposttime'], next);
|
||||
}
|
||||
], function(err, topics) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
privileges.topics.filter('read', tids, 0, function(err, tids) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
topics.getTopicsFields(tids, ['tid', 'title', 'lastposttime'], function(err, topics) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
topics.forEach(function(topic) {
|
||||
if (topic) {
|
||||
topicUrls.push({
|
||||
url: '/topic/' + topic.tid + '/' + encodeURIComponent(utils.slugify(topic.title)),
|
||||
lastmodISO: utils.toISOString(topic.lastposttime),
|
||||
changefreq: 'daily',
|
||||
priority: '0.6'
|
||||
});
|
||||
}
|
||||
topics.forEach(function(topic) {
|
||||
if (topic) {
|
||||
topicUrls.push({
|
||||
url: '/topic/' + topic.tid + '/' + encodeURIComponent(utils.slugify(topic.title)),
|
||||
lastmodISO: utils.toISOString(topic.lastposttime),
|
||||
changefreq: 'daily',
|
||||
priority: '0.6'
|
||||
});
|
||||
|
||||
next(null, topicUrls);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
next(null, topicUrls);
|
||||
});
|
||||
}
|
||||
}, function(err, data) {
|
||||
|
||||
Reference in New Issue
Block a user