feat: enhance related posts logic to exclude already shown navigation items
This commit is contained in:
1 parent
bacda9011c
commit
150194e11e
1 file changed
+5
-1
+5
-1
@@ -204,8 +204,12 @@
|
||||
$bdCur = $page->key();
|
||||
$bdCat = $page->categoryKey();
|
||||
$bdTags = array_keys($page->tags(true));
|
||||
// Skip the posts already shown in the older/newer nav just above.
|
||||
$bdNavShown = array();
|
||||
if (!empty($bdOlder)) { $bdNavShown[] = $bdOlder->key(); }
|
||||
if (!empty($bdNewer)) { $bdNavShown[] = $bdNewer->key(); }
|
||||
foreach ($bdKeys as $bdK) {
|
||||
if ($bdK === $bdCur) { continue; }
|
||||
if ($bdK === $bdCur || in_array($bdK, $bdNavShown, true)) { continue; }
|
||||
if (count($bdRelated) >= 3) { break; }
|
||||
$bdCand = new Page($bdK);
|
||||
$bdMatch = ($bdCat && $bdCand->categoryKey() === $bdCat);
|
||||
|
||||
Reference in new issue
Block a user