{{ $truncatedEntryCount := sub (len $pages_tmp) $sidebarMenuTruncate -}}
{{ if gt $truncatedEntryCount 0 -}}
{{ warnf "WARNING: %d sidebar entries have been truncated. To avoid this, increase `params.ui.sidebar_menu_truncate` to at least %d (from %d) in your config file. Section: %s"
<liclass="td-sidebar-nav__section-title td-sidebar-nav__section{{ if $withChild }} with-child{{ else }} without-child{{ end }}{{ if $activePath }} active-path{{ end }}{{ if (not (or $show $p.Site.Params.ui.sidebar_menu_foldable )) }} collapse{{ end }}"id="{{ $mid }}-li">
{{ if (and $p.Site.Params.ui.sidebar_menu_foldable (ge $ulNr 1)) -}}
<labelfor="{{ $mid }}-check"><ahref="{{ $manualLink }}"{{ifne$s.LinkTitle$manualLinkTitle}}title="{{ $manualLinkTitle }}"{{end}}{{with$s.Params.manualLinkTarget}}target="{{ . }}"{{ifeq."_blank"}}rel="noopener"{{end}}{{end}}class="align-left ps-0 {{ if $active}} active{{ end }} td-sidebar-link{{ if $s.IsPage }} td-sidebar-link__page{{ else }} td-sidebar-link__section{{ end }}{{ if $treeRoot }} tree-root{{ end }}"id="{{ $mid }}">{{ with $s.Params.Icon}}<iclass="{{ . }}"></i>{{ end }}<spanclass="{{ if $active }}td-sidebar-nav-active-item{{ end }}">{{ $s.LinkTitle }}</span></a></label>
{{ else -}}
<ahref="{{ $manualLink }}"{{ifne$s.LinkTitle$manualLinkTitle}}title="{{ $manualLinkTitle }}"{{end}}{{with$s.Params.manualLinkTarget}}target="{{ . }}"{{ifeq."_blank"}}rel="noopener"{{end}}{{end}}class="align-left ps-0{{ if $active}} active{{ end }} td-sidebar-link{{ if $s.IsPage }} td-sidebar-link__page{{ else }} td-sidebar-link__section{{ end }}{{ if $treeRoot }} tree-root{{ end }}"id="{{ $mid }}">{{ with $s.Params.Icon}}<iclass="{{ . }}"></i>{{ end }}<spanclass="{{ if $active }}td-sidebar-nav-active-item{{ end }}">{{ $s.LinkTitle }}</span></a>
{{- end }}
{{- if $withChild }}
{{- $ulNr := add $ulNr 1 }}
<ulclass="ul-{{ $ulNr }}{{ if (gt $ulNr 1)}} foldable{{end}}">