{% for menuItem in menu|sort((a, b) => a.priority <=> b.priority) %}
{% set isActive = menuItem.page and menuItem.page.lft <= page.lft and page.rgt <= menuItem.page.rgt %}
{% if menuItem.isActive %}
<div class="page-links__link swiper-slide">
<a href="{{ menuItem.toUrl() ? menuItem.toUrl() : 'javascript:void(0);' }}"
class="{{ isActive ? 'active' }}">{{ menuItem.name }}</a>
</div>
{% endif %}
{% endfor %}