diff --git a/site/config/routes/virtual-category.php b/site/config/routes/virtual-category.php index 782e4d4..75023aa 100644 --- a/site/config/routes/virtual-category.php +++ b/site/config/routes/virtual-category.php @@ -11,13 +11,17 @@ return [ fn($text) => Str::slug($text->category()) === $category ); - $children = new Pages(); + $texts = []; foreach ($textsInCategory as $text) { - $children->add($text); + $texts[] = (string) $text->uri(); } - $title = $textsInCategory->first()->category(); + try { + $title = $textsInCategory->first()->category(); + } catch (\Throwable $th) { + go('/erreur'); + } return Page::factory([ 'slug' => Str::slug($category) . '-' . Uuid::generate(), @@ -25,9 +29,9 @@ return [ 'model' => 'category', 'content' => [ 'title' => $title, + 'texts' => Yaml::encode($texts), 'uuid' => Uuid::generate(), ], - 'children' => $children->toArray(), ]); }, ]; diff --git a/site/snippets/nav__texts--all.php b/site/snippets/nav__texts--all.php index c3b12bc..4f1b6a5 100644 --- a/site/snippets/nav__texts--all.php +++ b/site/snippets/nav__texts--all.php @@ -34,7 +34,7 @@ dans parent()->title() ?> / category() ?> + href="/categories/category()) ?>">category() ?>

diff --git a/site/snippets/nav__texts--collection.php b/site/snippets/nav__texts--collection.php index b9e46e8..692845a 100644 --- a/site/snippets/nav__texts--collection.php +++ b/site/snippets/nav__texts--collection.php @@ -52,7 +52,7 @@ dans parent()->title() ?> / category() ?> + href="/categories/category()) ?>">category() ?>

diff --git a/site/templates/category.php b/site/templates/category.php index 48f2878..bf96628 100644 --- a/site/templates/category.php +++ b/site/templates/category.php @@ -14,7 +14,7 @@ @click="edito = !edito">Lire