mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 11:34:24 +03:00
13b65cecb9
closes #2261 - reserved 'feed' in the list of reserved keywords for slugs - added a 301 redirect from /feed/ to /rss/ - added a route test, and realised that standard express redirects don't get the right headers - fixed the headers across all 301 redirects & added tests for the admin redirects - removed the redirect from /ghost/login/ to /ghost/signin/ as this happens automatically if you're logged out, and isn't very useful if you're logged in as it just redirects again to /ghost/
29 lines
901 B
JavaScript
29 lines
901 B
JavaScript
var frontend = require('../controllers/frontend'),
|
|
config = require('../config'),
|
|
|
|
ONE_HOUR_S = 60 * 60,
|
|
ONE_YEAR_S = 365 * 24 * ONE_HOUR_S;
|
|
|
|
module.exports = function (server) {
|
|
var subdir = config().paths.subdir;
|
|
|
|
// ### Frontend routes
|
|
server.get('/rss/', frontend.rss);
|
|
server.get('/rss/:page/', frontend.rss);
|
|
server.get('/feed/', function redirect(req, res) {
|
|
/*jshint unused:true*/
|
|
res.set({'Cache-Control': 'public, max-age=' + ONE_YEAR_S});
|
|
res.redirect(301, subdir + '/rss/');
|
|
});
|
|
|
|
|
|
server.get('/tag/:slug/rss/', frontend.rss);
|
|
server.get('/tag/:slug/rss/:page/', frontend.rss);
|
|
server.get('/tag/:slug/page/:page/', frontend.tag);
|
|
server.get('/tag/:slug/', frontend.tag);
|
|
server.get('/page/:page/', frontend.homepage);
|
|
server.get('/', frontend.homepage);
|
|
server.get('*', frontend.single);
|
|
|
|
|
|
}; |