<div class="localtoc">
  {%- if page_nav_items -%}
    <p class="caption">On this page</p>
    <ul>
      {%- for item in page_nav_items -%}
        <li>
          <a href="{{ item.href }}" class="page-nav-link">{{ item.title }}</a>
          {%- if item.children -%}
            <ul>
              {%- for subitem in item.children -%}
                <li>
                  <a href="{{ subitem.href }}" class="page-nav-link">{{ subitem.title }}</a
                    >
                  </li>
                {%- endfor -%}
              </ul>
            {%- endif -%}
          </li>
        {%- endfor -%}
      </ul>
    {%- endif -%}
    <p>
      <a href="#top">Back to top</a>
    </p>
  </div>
