From 10627740768c600c5a60f7f9149bcd82539a9b63 Mon Sep 17 00:00:00 2001 From: Matt Stauffer Date: Fri, 23 Oct 2026 17:17:09 -0400 Subject: [PATCH 1/4] Update archive LastModified to pull from latest news article --- public/archive/2026.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/public/archive/2026.php b/public/archive/2026.php index 82d4c513d6..1f6312f9ad 100644 --- a/public/archive/2026.php +++ b/public/archive/2026.php @@ -5,7 +5,13 @@ $_SERVER['BASE_PAGE'] = 'archive/2026.php'; require_once __DIR__ . '/../../include/prepend.inc'; news_archive_sidebar(); -site_header("News Archive - 2026", ['cache' => true, 'cache_control' => 15 * 60]); +$news = (new NewsHandler())->getNewsByYear(2026); + +$lastModified = $news === [] + ? time() + : max(array_map(static fn (array $entry): int => strtotime($entry['published']), $news)); + +site_header("News Archive - 2026", ['cache' => $lastModified, 'cache_control' => 15 * 60]); ?>

News Archive - 2026

@@ -18,5 +24,5 @@ getNewsByYear(2026), null, 500); +print_news($news, null, 500); site_footer(['elephpants' => true, 'sidebar' => $SIDEBAR_DATA]); From e3cfa6611a633e994abaf4f97821eabd5f9bf7e6 Mon Sep 17 00:00:00 2001 From: Matt Stauffer Date: Fri, 23 Oct 2026 17:23:57 -0400 Subject: [PATCH 2/4] Update archive LastModified to consider 2026.php mtime as well --- public/archive/2026.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/archive/2026.php b/public/archive/2026.php index 1f6312f9ad..a8a523846f 100644 --- a/public/archive/2026.php +++ b/public/archive/2026.php @@ -7,11 +7,11 @@ news_archive_sidebar(); $news = (new NewsHandler())->getNewsByYear(2026); -$lastModified = $news === [] - ? time() - : max(array_map(static fn (array $entry): int => strtotime($entry['published']), $news)); +// Set Last-Modified to the newer of [file mtime or latest article] +$timestamps = array_map(static fn (array $entry): int => strtotime($entry['published']), $news); +$timestamps[] = filemtime(__FILE__); -site_header("News Archive - 2026", ['cache' => $lastModified, 'cache_control' => 15 * 60]); +site_header("News Archive - 2026", ['cache' => max($timestamps), 'cache_control' => 15 * 60]); ?>

News Archive - 2026

From f39ed9813441fd31f6f8ffd5a2a51496f9088ec8 Mon Sep 17 00:00:00 2001 From: Matt Stauffer Date: Fri, 23 Oct 2026 17:35:36 -0400 Subject: [PATCH 3/4] Extract archive page Last Modified to helper --- include/layout.inc | 14 ++++++++++++++ public/archive/2026.php | 9 ++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/include/layout.inc b/include/layout.inc index 33c7655cbc..d8295cc729 100644 --- a/include/layout.inc +++ b/include/layout.inc @@ -367,6 +367,20 @@ function news_archive_sidebar(): void } } +// Get Last-Modified timestamp for a year's archive page: +// mtime of file or latest article, whicher is newer +function news_archive_last_modified(array $news, string $pageFile): int +{ + $timestamps = array_map(static fn (array $entry): int => strtotime($entry['published']), $news); + + $mtime = filemtime($pageFile); + if ($mtime !== false) { + $timestamps[] = $mtime; + } + + return $timestamps === [] ? time() : max($timestamps); +} + // Print news function print_news($news, $dog, $max = 5, $return = false) { $retval = []; diff --git a/public/archive/2026.php b/public/archive/2026.php index a8a523846f..21c87d4366 100644 --- a/public/archive/2026.php +++ b/public/archive/2026.php @@ -7,11 +7,10 @@ news_archive_sidebar(); $news = (new NewsHandler())->getNewsByYear(2026); -// Set Last-Modified to the newer of [file mtime or latest article] -$timestamps = array_map(static fn (array $entry): int => strtotime($entry['published']), $news); -$timestamps[] = filemtime(__FILE__); - -site_header("News Archive - 2026", ['cache' => max($timestamps), 'cache_control' => 15 * 60]); +site_header("News Archive - 2026", [ + 'cache' => news_archive_last_modified($news, __FILE__), + 'cache_control' => 15 * 60, +]); ?>

News Archive - 2026

From c62880772f07965c291bc056e5e23475a8b5345f Mon Sep 17 00:00:00 2001 From: Matt Stauffer Date: Fri, 23 Oct 2026 17:54:19 -0400 Subject: [PATCH 4/4] Fix doc block typo and satisfy PHPStan --- include/layout.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/layout.inc b/include/layout.inc index d8295cc729..fa0f2a0348 100644 --- a/include/layout.inc +++ b/include/layout.inc @@ -367,8 +367,9 @@ function news_archive_sidebar(): void } } -// Get Last-Modified timestamp for a year's archive page: -// mtime of file or latest article, whicher is newer +// Get Last-Modified timestamp for a year's archive page: +// mtime of file or latest article, whichever is newer +/** @param list> $news */ function news_archive_last_modified(array $news, string $pageFile): int { $timestamps = array_map(static fn (array $entry): int => strtotime($entry['published']), $news);