Fix menu links

This commit is contained in:
Samuel Štancl 2019-09-21 19:55:02 +02:00
parent 4175a60f85
commit 478452d1eb
2 changed files with 4 additions and 1 deletions

View file

@ -43,4 +43,7 @@ return [
'url' => function ($page, $path) { 'url' => function ($page, $path) {
return starts_with($path, 'http') ? $path : '/'.trimPath($path); return starts_with($path, 'http') ? $path : '/'.trimPath($path);
}, },
'isUrl' => function ($page, $path) {
return starts_with($path, 'http');
},
]; ];

View file

@ -1,7 +1,7 @@
<li class="list-reset pl-4"> <li class="list-reset pl-4">
@if ($url = is_string($item) ? $item : $item->url) @if ($url = is_string($item) ? $item : $item->url)
{{-- Menu item with URL--}} {{-- Menu item with URL--}}
<a href="{{ $page->url($url) ? $url : $page->link($url) }}" <a href="{{ $page->isUrl($url) ? $url : $page->link($url) }}"
class="{{ 'lvl' . $level }} {{ $page->isActiveParent($item) ? 'lvl' . $level . '-active' : '' }} {{ $page->isActive($url) ? 'active font-semibold text-blue' : '' }} nav-menu__item hover:text-blue" class="{{ 'lvl' . $level }} {{ $page->isActiveParent($item) ? 'lvl' . $level . '-active' : '' }} {{ $page->isActive($url) ? 'active font-semibold text-blue' : '' }} nav-menu__item hover:text-blue"
> >
{{ $label }} {{ $label }}