{%- set paths = page.path.split('/') %} {%- set count = paths.length %} {%- if count > 2 %} {%- set link = '/' %} {%- endif %}