{{ define "render-menu" }}
{{ $root := .root }}
{{ $ctx := .ctx }}
{{ $depth := .depth }}
{{ $currentURL := $root.Permalink }}
{{ $sectionName1 := index (last 1 (split (delimit (split $ctx.Permalink "/") "," "") ",")) 0 }}
{{ $sectionName2 := index (last 2 (split (delimit (split $currentURL "/") "," "") ",")) 0 }}
{{ $active := in $currentURL $ctx.Permalink }}
{{ $active = or $active (eq $sectionName1 $sectionName2) }}
{{ $active = or $active (in $currentURL $sectionName1) }}
{{ if $ctx.Params.Collapsible }}
{{ else }}
{{ $lastUrlElement1 := index (last 1 (split (delimit (split $ctx.Permalink "/") "," "") ",")) 0 }}
{{ $lastUrlElement2 := index (last 1 (split (delimit (split $currentURL "/") "," "") ",")) 0 }}
{{ end }}
{{ end }}