Add page publication history and reusable blocks

This commit is contained in:
2026-11-28 18:12:30 +08:00
parent 1c927d360c
commit 3b13f6533d
40 changed files with 1239 additions and 165 deletions
+2 -2
View File
@@ -38,7 +38,7 @@ final class SiteController
public function page(Request $request, string $slug): Response
{
$repo = new Repository();
$page = $repo->page($slug);
$page = $repo->publishedPage($slug);
if (!$page || $page['layout_kind'] !== null || !in_array($page['page_type'], ['page', 'home'], true)
|| $page['status'] !== 'published') {
return $this->missing($request);
@@ -238,7 +238,7 @@ final class SiteController
$entry = preg_match('~^/(?:admin|account)(?:/|$)~D', $normal)
&& Route::dispatch($request->method(), $normal)[0] === Dispatcher::FOUND;
$single = preg_match('~^/[a-z0-9]+(?:-[a-z0-9]+)*$~D', $normal);
$page = $single ? (new Repository())->page(substr($normal, 1)) : null;
$page = $single ? (new Repository())->publishedPage(substr($normal, 1)) : null;
if ($entry || ($page && $page['layout_kind'] === null && in_array($page['page_type'], ['page', 'home'], true) && $page['status'] === 'published')
|| preg_match('~^/articles(?:/[a-z0-9-]+){1,2}$~D', $normal)) {
$query = $request->queryString();