From 12fb512d3c1e5fddb585b409d586172000d5d005 Mon Sep 17 00:00:00 2001 From: yariplus Date: Tue, 1 Dec 2015 12:59:18 -0500 Subject: [PATCH] Don't change url when homepage is set to a category. --- src/controllers/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/controllers/index.js b/src/controllers/index.js index f418c16572..fa414e1db5 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -50,7 +50,16 @@ Controllers.home = function(req, res, next) { } else if (route === 'popular') { Controllers.popular.get(req, res, next); } else { - res.redirect(route); + var match = /^category\/(\d+)\/(.*)$/.exec(route); + + if (match) { + req.params.topic_index = "1"; + req.params.category_id = match[1]; + req.params.slug = match[2]; + Controllers.categories.get(req, res, next); + } else { + res.redirect(route); + } } } });