{% load menu_tags %} {% load i18n %} {% load descendant_selected %} {# find the active page in the tree. Assume it must be a grandchild or great-grandchild of the softroot #} {% for child in children %} {# this level is the children of the softroot, e.g. Instructions, Challenges #} {% for grandchild in child.children %} {% descendant_selected grandchild as show_this_branch %} {# only show this menu if it includes a selected node #} {% if show_this_branch %} {% if grandchild.selected %} {# the first, ancestor page #}