      {# Include the first two levels of TOC data as a JS object, to be rendered in top frame #}
        var pageToc = [
        {%- for item in page.toc %}
          {title: {{ item.title|tojson }}, url: {{ ('#_top' if loop.first else item.url)|tojson }}, children: [
            {%- for item in item.children %}
              {title: {{ item.title|tojson }}, url: {{ item.url|tojson }} },
            {%- endfor %}
          ]},
        {%- endfor %}
        ];
      {%- else %}
        var page_toc = null;
 