mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 02:11:44 +03:00
4f9b72ff43
- This is a minor bugbare, but it will affect some configuration I'm about to do for c8 - I've been wanting to do it for ages, middleware is plural all on it's own so it's an odd affectation in our codebase - This also only exists in 2 places, everywhere else we use "middleware" - Sadly it did result in a lot of churn as I did a full find and replace, but consistency is king!
20 lines
638 B
JavaScript
20 lines
638 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 optimize 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');
|
|
const config = require('../../../../shared/config');
|
|
|
|
module.exports = [
|
|
slashes(true, {
|
|
headers: {
|
|
'Cache-Control': `public, max-age=${config.get('caching:301:maxAge')}`
|
|
}
|
|
}),
|
|
require('./uncapitalise')
|
|
];
|