{{ if and (ne .Params.toc false) (ne .TableOfContents "<nav id=\"TableOfContents\"></nav>") -}}
<div class="d-xl-none">
  <button class="btn btn-outline-primary btn-sm doks-toc-toggle collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#onThisPage" aria-controls="doks-docs-nav" aria-expanded="false" aria-label="Toggle On this page navigation">
    <span>{{ i18n "on-this-page" }}</span>
    <span>
      <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" class="doks doks-expand" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><title>Expand</title><polyline points="7 13 12 18 17 13"></polyline><polyline points="7 6 12 11 17 6"></polyline></svg>
      <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" class="doks doks-collapse" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><title>Collapse</title><polyline points="17 11 12 6 7 11"></polyline><polyline points="17 18 12 13 7 18"></polyline></svg>
    </span>
  </button>
  <div class="collapse" id="onThisPage">
    <div class="card card-body mt-3 py-1">
      <div class="page-links">
        {{ .TableOfContents }}
      </div>
    </div>
  </div>
</div>
<div class="page-links d-none d-xl-block">
  <h3>{{ i18n "on-this-page" }}</h3>
  {{ if eq .Site.Params.options.scrollSpy true -}}
    {{ .TableOfContents | replaceRE "<nav id=\"TableOfContents\">" "<nav id=\"toc\">" | safeHTML }}
  {{ else -}}
    {{ .TableOfContents }}
  {{ end -}}
</div>
{{ end -}}
