{% macro menu() %} {# I am almost certain this check isn't necessary, that it will always return true, but the only alternative I can think of is the case where this config value simply doesn't exist (null)? IDK, just copying from original implementation for now. #} {% if config.extra.show_menu_items is defined -%} {% for menu_item in config.extra.main_menu | slice(end=config.extra.show_menu_items) -%} {# Original theme has sub-children checks on main-menu, not worrying about that here. #} {{ menu_item.name }} {% endfor -%} {%- set main_len = config.extra.main_menu | length -%} {%- set show_len = config.extra.show_menu_items -%} {%- if main_len > show_len -%} {{ config.extra.menu_more }} ▾ {{ menu::items(menu=config.extra.main_menu | slice(start=config.extra.show_menu_items)) }} {%- endif -%} {# Continues the original if-check at top of file for show_menu_items #} {% else -%} {{ menu::items(menu=config.extra.main_menu) }} {%- endif -%} {{ menu::items(menu=config.extra.main_menu) }} {% endmacro menu %} {% macro items(menu) %} {%- for menu_item in menu -%} {# skipping sub-child check #}