From b4c06f537da74eb43c23975c8465db5a30b86df5 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 14 Apr 2015 19:08:46 -0600 Subject: [PATCH] added page expires --- system/config/system.yaml | 2 ++ system/src/Grav/Common/Grav.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/system/config/system.yaml b/system/config/system.yaml index 4744a01ed..ba2a153a9 100644 --- a/system/config/system.yaml +++ b/system/config/system.yaml @@ -31,6 +31,7 @@ pages: '>': 'gt' '<': 'lt' types: 'txt|xml|html|json|rss|atom' # Pipe separated list of valid page types + expires: 604800 # Page expires time in seconds (default 7 days) cache: enabled: true # Set to true to enable caching @@ -41,6 +42,7 @@ cache: lifetime: 604800 # Lifetime of cached data in seconds (0 = infinite) gzip: false # GZip compress the page output + twig: cache: true # Set to true to enable twig caching debug: false # Enable Twig debug diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index 832c00e89..37cee3cd8 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -298,6 +298,8 @@ class Grav extends Container $extension = $this['uri']->extension(); header('Content-type: ' . $this->mime($extension)); + header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + $this['config']->get('system.pages.expires'))); + // Set debugger data in headers if (!($extension === null || $extension == 'html')) { $this['debugger']->enabled(false);