File: D:/HostingSpaces/ZelfVerkopen/zelfverkopen.nl/resources/views/site/partials/sitemapLoop.blade.php
@if($sitemapItem->active && (isset($landingPages) && !$landingPages && $sitemapItem->code_name != ''))
<li>
<a href="/{{$sitemapItem->translation->route->alias}}">{{$sitemapItem->translation->name}}</a>
</li>
{{-- Check if sitemap item is all the end of the tree branch --}}
@unless($sitemapItem->rgt == $sitemapItem->lft+1)
@php
$childPages = new \Illuminate\Database\Eloquent\Collection($page->findChildren());
$childPages = $childPages->load('translation', 'translation.route');
@endphp
{{-- Check if the sitemap item has children --}}
@if(sizeof($childPages) != 0)
{{-- If it does, recall this blade with the found child as item --}}
<ul>
@foreach($childPages as $child)
@include('layouts.partials.sitemapLoop', ['sitemapItem' => $child, 'landingPages' => $landingPages])
@endforeach
</ul>
@endif
@endunless
@endif