0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

automatically insert Link rel="preload" headers

This commit is contained in:
Terin Stock 2016-04-22 11:26:28 -07:00
parent 0f75fc30b9
commit 7bbfc37df6
3 changed files with 12 additions and 1 deletions

View file

@ -212,7 +212,8 @@ ConfigManager.prototype.set = function (config) {
}, },
deprecatedItems: ['updateCheck', 'mail.fromaddress'], deprecatedItems: ['updateCheck', 'mail.fromaddress'],
// create a hash for cache busting assets // create a hash for cache busting assets
assetHash: assetHash assetHash: assetHash,
preloadHeaders: this._config.preloadHeaders || false
}); });
// Also pass config object to // Also pass config object to

View file

@ -25,6 +25,7 @@ var bodyParser = require('body-parser'),
themeHandler = require('./theme-handler'), themeHandler = require('./theme-handler'),
uncapitalise = require('./uncapitalise'), uncapitalise = require('./uncapitalise'),
cors = require('./cors'), cors = require('./cors'),
netjet = require('netjet'),
ClientPasswordStrategy = require('passport-oauth2-client-password').Strategy, ClientPasswordStrategy = require('passport-oauth2-client-password').Strategy,
BearerStrategy = require('passport-http-bearer').Strategy, BearerStrategy = require('passport-http-bearer').Strategy,
@ -70,6 +71,14 @@ setupMiddleware = function setupMiddleware(blogApp, adminApp) {
} }
} }
// Preload link headers
if (config.preloadHeaders) {
blogApp.use(netjet({
cache: {
max: config.preloadHeaders
}
}));
}
// Favicon // Favicon
blogApp.use(serveSharedFile('favicon.ico', 'image/x-icon', utils.ONE_DAY_S)); blogApp.use(serveSharedFile('favicon.ico', 'image/x-icon', utils.ONE_DAY_S));

View file

@ -53,6 +53,7 @@
"moment": "2.13.0", "moment": "2.13.0",
"morgan": "1.7.0", "morgan": "1.7.0",
"multer": "1.1.0", "multer": "1.1.0",
"netjet": "1.1.0",
"node-uuid": "1.4.7", "node-uuid": "1.4.7",
"nodemailer": "0.7.1", "nodemailer": "0.7.1",
"oauth2orize": "1.2.2", "oauth2orize": "1.2.2",