From a2f3149796c1aac3b6f22d181b086839ad887d46 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Wed, 19 Mar 2025 13:34:19 -0400 Subject: [PATCH] Only include parent if requested (and its requested by default) --- src/Tags/Structure.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Tags/Structure.php b/src/Tags/Structure.php index a3a132dc9f..fb29c72066 100644 --- a/src/Tags/Structure.php +++ b/src/Tags/Structure.php @@ -136,7 +136,6 @@ public function toArray($tree, $parent = null, $depth = 1) return array_merge($data, [ 'children' => $children, - 'parent' => $parent, 'depth' => $depth, 'index' => $index, 'count' => $index + 1, @@ -145,7 +144,7 @@ public function toArray($tree, $parent = null, $depth = 1) 'is_current' => ! is_null($url) && rtrim($url, '/') === rtrim($this->currentUrl, '/'), 'is_parent' => ! is_null($url) && $this->siteAbsoluteUrl !== $absoluteUrl && URL::isAncestorOf($this->currentUrl, $url), 'is_external' => URL::isExternal((string) $absoluteUrl), - ]); + ], $this->params->bool('include_parents', true) ? ['parent' => $parent] : []); })->filter()->values(); $this->updateIsParent($pages);