<div class="side-nav">
    {{ if .Site.Params.use_advanced_docs }}
        {{ $version := .CurrentSection.Params.version }}
        {{ .Render "versions" }}
        {{ .Render "search" }}
        {{ if $version }}
            {{ $tocTemplateName := index (index $.Site.Data.docs "toc-mapping") $version }}
            {{ if not $tocTemplateName }}
                {{ $tocTemplateName = "default" }}
            {{ end }}
            {{ $toc := (index $.Site.Data "docs" $tocTemplateName).toc }}
            {{ range $toc }}
                <h4>{{ .title }}</h4>
                <ul>
                    {{ range .subfolderitems }}
                    <li>
                        {{ if .link }}
                            <a href="{{ .link }}">{{ .page }}</a>
                        {{ else }}
                            {{ $url :=  (index (print "/docs/" $version .url "/"))  }}
                            <a href="{{ $url }}" {{ if (eq  $.Page.RelPermalink $url)  }}class="active"{{ end }}>{{ .link }} {{ .page }}</a>
                        {{ end }}
                    </li>
                    {{ end }}
                </ul>
            {{ end }}
        {{ end }}
    {{ else }}
        <ul>
            {{ $currentPage := . }}
            {{ range .Site.Menus.docs }}
                <li><a href="{{ .URL }}" {{ if (eq $currentPage.RelPermalink .URL)  }}class="active"{{ end }}>{{ .Name }}</a></li>
            {{ end }}
        </ul>
    {{ end }}
</div>