Skip to content

Node.js based forum software built for the modern web

fix for topics without category data (?)

psychobunny2b90add5607c
diff --git a/src/controllers/topics.js b/src/controllers/topics.js
index 283a1bcc7c..fa463ab703 100644
--- a/src/controllers/topics.js
+++ b/src/controllers/topics.js
@@ -201,17 +201,20 @@ topicsController.get = function(req, res, next) {
rel: 'alternate',
type: 'application/rss+xml',
href: nconf.get('url') + '/topic/' + tid + '.rss'
- },
- {
- rel: 'up',
- href: nconf.get('url') + '/category/' + topicData.category.slug
- },
+ }
{
rel: 'canonical',
href: nconf.get('url') + '/topic/' + topicData.slug
}
];
+ if (topicData.category) {
+ res.locals.linkTags.push({
+ rel: 'up',
+ href: nconf.get('url') + '/category/' + topicData.category.slug
+ });
+ }
+
next(null, topicData);
}
], function (err, data) {