From e6fd79bad907c18e35fb2f99842b0ab62ed67114 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Thu, 26 Feb 2026 10:24:43 -0500 Subject: start caching html pages, lower request tree chaining --- src/web/_views/bucket/main.php | 18 +++++++++--------- src/web/_views/head.php | 27 +++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 11 deletions(-) (limited to 'src/web/_views') diff --git a/src/web/_views/bucket/main.php b/src/web/_views/bucket/main.php index aeb6cf3..b85c773 100644 --- a/src/web/_views/bucket/main.php +++ b/src/web/_views/bucket/main.php @@ -1,13 +1,13 @@ - view('head', $data); - if ($lightmode === 'true') { - echo $this->link_css('css/bucket_light.css'); - } else { - echo $this->link_css('css/bucket.css'); - } - ?> +view('head', $data); + if ($lightmode === 'true') { + echo embed_css_ext('css/bucket_light.css'); + } else { + echo embed_css_ext('css/bucket.css'); + } +?> diff --git a/src/web/_views/head.php b/src/web/_views/head.php index 1ca6954..8cd6f87 100644 --- a/src/web/_views/head.php +++ b/src/web/_views/head.php @@ -1,4 +1,19 @@ +req['app']; + $non_cached_apps = ['blog']; + + if (ENVIRONMENT == 'production' && !in_array($current_app, $non_cached_apps)) { + $cache_seconds = 300; + if ($current_app == 'bucket') { + $cache_seconds = 3600; + } + header("Cache-Control: public, max-age=$cache_seconds"); + header("Expires: " . gmdate('D, d M Y H:i:s', time() + $cache_seconds) . " UTC"); + header("Pragma: cache"); + } +?> @@ -21,10 +36,18 @@ "> "> + + " as="font" type="font/woff2" crossorigin> + " as="font" type="font/woff2" crossorigin> + + + " as="font" type="font/woff2" crossorigin> + req['app'] != 'bucket') - echo $this->link_css('css/main.css'); + if (ROUTER->req['app'] != 'bucket') { + echo embed_css_ext('css/main.css'); + } /* IE 4-7 Styles */ echo ie($this->embed_css('css/ie/ie.css')); -- cgit v1.2.3-freya