{% set toc_ = page.toc %} {% if toc_ | first is defined and "\x3ch1 id=" in page.content %} {% set toc_ = (toc_ | first).children %} {% endif %}