Feat: pages Article + navigation blog/article interne
All checks were successful
Deploy / Deploy to Production (push) Successful in 19s

- Router: findSlideIndex() avec fallback parent path
  (/blog/slug → /blog) pour sub-pages
- article.json.php: réécriture — date, intro, cover, body (blocks→HTML),
  related articles (fallback siblings si vide)
- Article.svelte: sous-composant — topbar date+retour, titre Terminal,
  intro, cover, body rich text (styles :global pour blocks Kirby),
  related articles grid, responsive
- Blog.svelte: gère deux modes (liste + article) —
  intercepte les clics article via stopPropagation (avant le router),
  fetch article data, pushState pour URL, popstate pour back/forward,
  direct navigation /blog/slug sur mount

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-03-10 16:55:34 +01:00
parent 3ab4b21e8c
commit 0505cc7b8e
4 changed files with 465 additions and 97 deletions

View file

@ -6,26 +6,19 @@ if ($related->isEmpty()) {
}
$specificData = [
'date' => $page->date()->toDate('Y-m-d'),
'dateFormatted' => $page->date()->toDate('d/m/Y'),
'intro' => $page->intro()->value(),
'author' => [
'name' => $page->authorName()->value(),
'role' => $page->authorRole()->value(),
'photo' => $page->authorPhoto()->toFile()?->url()
],
'cover' => $page->cover()->toFile()?->url(),
'content' => $page->articleContent()->toBlocks(),
'tags' => $page->tags()->split(),
'related' => $related->map(function($rec) {
'date' => $page->date()->toDate('d/m/Y'),
'intro' => $page->intro()->value(),
'cover' => $page->cover()->toFile()?->url(),
'body' => (string) $page->body()->toBlocks(),
'related' => $related->map(function($rec) {
return [
'title' => $rec->title()->value(),
'url' => $rec->url(),
'category' => $rec->category()->value(),
'cover' => $rec->cover()->toFile()?->thumb(['width' => 400])->url()
'slug' => $rec->slug(),
'date' => $rec->date()->toDate('d/m/Y'),
'cover' => $rec->cover()->toFile()?->url(),
];
})->values(),
'parentUrl' => $page->parent()->url()
'parentUrl' => $page->parent()->url(),
];
$pageData = array_merge($genericData, $specificData);