'game.html', 'studio' => 'studio.html', 'person' => 'person.html', 'games' => 'catalogue.html', 'studios' => 'studios.html', 'people' => 'people.html', ); $DETAIL_TYPES = array('game', 'studio', 'person'); $type = isset($_GET['t']) ? $_GET['t'] : ''; if (!isset($PAGES[$type])) { http_response_code(404); exit; } // Emits the pre-rendered and exits once it has something to serve. A // detail page falls through when it can't resolve: an unrecognised user // agent, no ?id/?slug to go on, or no such record (already 404'd by then). A // listing page falls through only for an unrecognised user agent or a failed // Supabase fetch — it has no record to look up. if (in_array($type, $DETAIL_TYPES, true)) { slc_meta_shim($type); } else { slc_meta_shim_list($type); } // Fallback: serve the normal static page, so a scraper still gets the site's // default preview rather than an empty body — and a missing record still // answers 404, with something readable attached. header('Content-Type: text/html; charset=utf-8'); readfile(__DIR__ . '/' . $PAGES[$type]);