forked from TryGhost/Ghost
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes TryGhost#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/
- Loading branch information
Showing
6 changed files
with
83 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,29 @@ | ||
var frontend = require('../controllers/frontend'); | ||
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) { | ||
/*jslint regexp: true */ | ||
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); | ||
|
||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters