File: D:/HostingSpaces/SBogers10/anvil.komma.pro/resources/views/site/partials/sitemapLoop.blade.php
@if($sitemapItem->active)
<li>
<a href="/{{$sitemapItem->translation->route->alias}}">{{$sitemapItem->translation->name}}</a>
{{-- Check if sitemap item is all the end of the tree branch --}}
@if($sitemapItem->rgt != $sitemapItem->lft+1)
@php
$childPages = new \Illuminate\Database\Eloquent\Collection($sitemapItem->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('site.partials.sitemapLoop', ['sitemapItem' => $child])
@endforeach
</ul>
@endif
@endif
</li>
@endif