0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server/web/middleware/pretty-urls.js
2018-09-10 14:07:57 +02:00

19 lines
623 B
JavaScript

// Pretty URL redirects
//
// These are two pieces of middleware that handle ensuring that
// URLs get formatted correctly.
// Slashes ensures that we get trailing slashes
// Uncapitalise changes case to lowercase
// @TODO optimise this to reduce the number of redirects required to get to a pretty URL
// @TODO move this to being used by routers?
const slashes = require('connect-slashes'),
config = require('../../config');
module.exports = [
slashes(true, {
headers: {
'Cache-Control': 'public, max-age=' + config.get('caching:301:maxAge')
}
}),
require('./uncapitalise')
];