mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
834cb73613
fixes #1803 - switches date permalinks from created_at to published_at - enforces that the post will ONLY render if the date is valid and correct
18 lines
No EOL
747 B
JavaScript
18 lines
No EOL
747 B
JavaScript
var frontend = require('../controllers/frontend');
|
|
|
|
module.exports = function (server) {
|
|
/*jslint regexp: true */
|
|
|
|
// ### Frontend routes
|
|
server.get('/rss/', frontend.rss);
|
|
server.get('/rss/:page/', frontend.rss);
|
|
server.get('/page/:page/', frontend.homepage);
|
|
// Only capture the :slug part of the URL
|
|
// This regex will always have two capturing groups,
|
|
// one for date, and one for the slug.
|
|
// Examples:
|
|
// Given `/plain-slug/` the req.params would be [undefined, 'plain-slug']
|
|
// Given `/2012/12/24/plain-slug/` the req.params would be ['2012/12/24/', 'plain-slug']
|
|
server.get(/^\/([0-9]{4}\/[0-9]{2}\/[0-9]{2}\/)?([^\/.]*)\/$/, frontend.single);
|
|
server.get('/', frontend.homepage);
|
|
}; |