'map-editor/pages/(:all)/check-regenerate-flag', 'method' => 'GET', 'auth' => false, 'action' => function (string $pageId) { try { $page = kirby()->page($pageId); if (!$page) { return [ 'status' => 'error', 'message' => 'Page not found', 'code' => 404 ]; } $markerFile = $page->root() . '/.regenerate-map-image'; $needsRegeneration = file_exists($markerFile); return [ 'status' => 'success', 'data' => [ 'needsRegeneration' => $needsRegeneration ] ]; } catch (Exception $e) { return [ 'status' => 'error', 'message' => $e->getMessage(), 'code' => 500 ]; } } ];