diff --git a/.gitignore b/.gitignore index beaa65aca1..fa9c9f69a8 100644 --- a/.gitignore +++ b/.gitignore @@ -104,6 +104,7 @@ projectFilesBackup /content/apps/**/* /content/themes/**/* /content/images/**/* +/content/media/**/* /content/adapters/storage/**/* /content/adapters/scheduling/**/* !/content/themes/casper diff --git a/core/frontend/web/site.js b/core/frontend/web/site.js index 8b1e9fe90f..124be8111e 100644 --- a/core/frontend/web/site.js +++ b/core/frontend/web/site.js @@ -21,8 +21,10 @@ const customRedirects = require('../../server/services/redirects'); const siteRoutes = require('./routes'); const shared = require('../../server/web/shared'); const mw = require('./middleware'); +const labs = require('../../shared/labs'); const STATIC_IMAGE_URL_PREFIX = `/${urlUtils.STATIC_IMAGE_URL_PREFIX}`; +const STATIC_MEDIA_URL_PREFIX = `/${constants.STATIC_MEDIA_URL_PREFIX}`; let router; @@ -109,6 +111,8 @@ module.exports = function setupSiteApp(options = {}) { // Serve blog images using the storage adapter siteApp.use(STATIC_IMAGE_URL_PREFIX, mw.handleImageSizes, storage.getStorage('images').serve()); + // Serve blog media using the storage adapter + siteApp.use(STATIC_MEDIA_URL_PREFIX, labs.enabledMiddleware('mediaAPI'), storage.getStorage('media').serve()); // @TODO find this a better home // We do this here, at the top level, because helpers require so much stuff.