From e45eb4d5ddf4c546725fbdd15e8ee44c0232df4a Mon Sep 17 00:00:00 2001 From: Naz Date: Tue, 27 Sep 2022 17:11:50 +0800 Subject: [PATCH] Made robots.txt caching configurable refs https://github.com/TryGhost/Toolbox/issues/411 - Having hardcoded cache control values in the codebase makes it impossible to experiment with new values without a version release. - Having all values configurable by default will allow for easier caching experiments and customizations on self-hosting instances. - Brings caching across both private and public robots file caching to same consistent and configurable value. --- ghost/core/core/frontend/web/site.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghost/core/core/frontend/web/site.js b/ghost/core/core/frontend/web/site.js index d62adf9048..a2c6bc84da 100644 --- a/ghost/core/core/frontend/web/site.js +++ b/ghost/core/core/frontend/web/site.js @@ -118,7 +118,7 @@ module.exports = function setupSiteApp(routerConfig) { debug('Themes done'); // Serve robots.txt if not found in theme - siteApp.use(mw.servePublicFile('static', 'robots.txt', 'text/plain', constants.ONE_HOUR_S)); + siteApp.use(mw.servePublicFile('static', 'robots.txt', 'text/plain', config.get('caching:robotstxt:maxAge'))); // site map - this should probably be refactored to be an internal app sitemapHandler(siteApp);