mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
2d01e15a18
refs #3076 - This is a first draft implementation, just to make it work so that we can get casper working
43 lines
No EOL
1.3 KiB
JavaScript
43 lines
No EOL
1.3 KiB
JavaScript
var frontend = require('../controllers/frontend'),
|
|
config = require('../config'),
|
|
express = require('express'),
|
|
|
|
ONE_HOUR_S = 60 * 60,
|
|
ONE_YEAR_S = 365 * 24 * ONE_HOUR_S,
|
|
|
|
frontendRoutes;
|
|
|
|
frontendRoutes = function () {
|
|
var router = express.Router(),
|
|
subdir = config().paths.subdir;
|
|
|
|
// ### Frontend routes
|
|
router.get('/rss/', frontend.rss);
|
|
router.get('/rss/:page/', frontend.rss);
|
|
router.get('/feed/', function redirect(req, res) {
|
|
/*jshint unused:true*/
|
|
res.set({'Cache-Control': 'public, max-age=' + ONE_YEAR_S});
|
|
res.redirect(301, subdir + '/rss/');
|
|
});
|
|
|
|
// Tags
|
|
router.get('/tag/:slug/rss/', frontend.rss);
|
|
router.get('/tag/:slug/rss/:page/', frontend.rss);
|
|
router.get('/tag/:slug/page/:page/', frontend.tag);
|
|
router.get('/tag/:slug/', frontend.tag);
|
|
|
|
// Authors
|
|
router.get('/author/:slug/rss/', frontend.rss);
|
|
router.get('/author/:slug/rss/:page/', frontend.rss);
|
|
router.get('/author/:slug/page/:page/', frontend.author);
|
|
router.get('/author/:slug/', frontend.author);
|
|
|
|
// Default
|
|
router.get('/page/:page/', frontend.homepage);
|
|
router.get('/', frontend.homepage);
|
|
router.get('*', frontend.single);
|
|
|
|
return router;
|
|
};
|
|
|
|
module.exports = frontendRoutes; |