Bug
The latestPages homepage block currently sorts pages by createdAt DESC. Admins can reorder pages within a category via drag-and-drop (Page.position), but the homepage block ignores that ordering.
Root cause
PageRepository::findPublishedByCategory() (src/Repository/PageRepository.php:73):
->orderBy('p.createdAt', 'DESC');
The admin list (createAdminListQueryBuilder, lines 170-171) already does it correctly:
->orderBy('p.position', 'ASC')
->addOrderBy('p.createdAt', 'DESC');
Fix
Replace the orderBy in findPublishedByCategory to mirror the admin query: position ASC, then createdAt DESC as tiebreaker.
Files
src/Repository/PageRepository.php:73
Verification
- In a category, drag-reorder the pages so the order differs from the creation order.
- Reload the homepage; the
latestPages block must render in the admin-defined order.
- Update the existing repository test (or add one) covering
findPublishedByCategory ordering.
Bug
The
latestPageshomepage block currently sorts pages bycreatedAt DESC. Admins can reorder pages within a category via drag-and-drop (Page.position), but the homepage block ignores that ordering.Root cause
PageRepository::findPublishedByCategory()(src/Repository/PageRepository.php:73):The admin list (
createAdminListQueryBuilder, lines 170-171) already does it correctly:Fix
Replace the
orderByinfindPublishedByCategoryto mirror the admin query:position ASC, thencreatedAt DESCas tiebreaker.Files
src/Repository/PageRepository.php:73Verification
latestPagesblock must render in the admin-defined order.findPublishedByCategoryordering.