Default to trailing slashes on the end of URLs

issue #448
This commit is contained in:
Hannah Wolfe 2013-09-17 02:16:15 +01:00
parent 16329ac6f0
commit 6a276668bc
2 changed files with 8 additions and 3 deletions

View File

@ -4,6 +4,7 @@ var express = require('express'),
_ = require('underscore'),
colors = require("colors"),
semver = require("semver"),
slashes = require("connect-slashes"),
errors = require('./server/errorHandling'),
admin = require('./server/controllers/admin'),
frontend = require('./server/controllers/frontend'),
@ -246,15 +247,15 @@ when.all([ghost.init(), helpers.loadCoreHelpers(ghost)]).then(function () {
// First determine whether we're serving admin or theme content
server.use(manageAdminAndTheme);
// set the view engine
server.set('view engine', 'hbs');
// Admin only config
server.use('/ghost', whenEnabled('admin', express['static'](path.join(__dirname, '/client/assets'))));
// Theme only config
server.use(whenEnabled(server.get('activeTheme'), express['static'](ghost.paths().activeTheme)));
// Add in all trailing slashes
server.use(slashes());
server.use(express.favicon(__dirname + '/shared/favicon.ico'));
server.use(express.bodyParser({}));
server.use(express.bodyParser({uploadDir: __dirname + '/content/images'}));
@ -266,6 +267,9 @@ when.all([ghost.init(), helpers.loadCoreHelpers(ghost)]).then(function () {
// So on every request we actually clean out reduntant passive notifications from the server side
server.use(cleanNotifications);
// set the view engine
server.set('view engine', 'hbs');
// Initialise the views
server.use(initViews);

View File

@ -13,6 +13,7 @@
"dependencies": {
"express": "3.3.4",
"express-hbs": "0.2.2",
"connect-slashes": "0.0.9",
"node-polyglot": "0.2.1",
"moment": "2.1.0",
"underscore": "1.5.1",