Display 404 page if tag does not exist.

closes #2667
- if tag result is '' 404 instead of rendering an empty page
- added test for /tag/asdf should 404
This commit is contained in:
Steve 2014-05-12 11:30:08 -07:00
parent 10759ed45a
commit eb2fdc44fb
2 changed files with 12 additions and 1 deletions

View File

@ -133,6 +133,10 @@ frontendControllers = {
tag: page.meta.filters.tags ? page.meta.filters.tags[0] : ''
});
// If the resulting tag is '' then 404.
if (!result.tag) {
return next();
}
res.render(view, result);
});
});

View File

@ -14,4 +14,11 @@ CasperTest.begin('Check frontend route not found (404)', 2, function suite(test)
test.assertEqual(response.status, 404, 'Response status should be 404.');
test.assertSelectorHasText('.error-code', '404');
});
}, true);
}, true);
CasperTest.begin('Check frontend tag route not found (404)', 2, function suite(test) {
casper.thenOpen(url + 'tag/asdf/', function (response) {
test.assertEqual(response.status, 404, 'Response status should be 404.');
test.assertSelectorHasText('.error-code', '404');
});
}, true);