{{ $current := . }}
{{ range .Site.Menus.main.ByWeight }}
{{ $topLevel := replace .URL "/" "" }}
{{ $active := "" }}
{{ if eq $current.RelPermalink .URL }}
{{ $active = "active" }}
{{ end }}
{{ if eq $current.Type $topLevel }}
{{ $active = "active" }}
{{ end }}
{{ if and (or (eq $current.RelPermalink .URL) (eq "term" $current.Kind)) (in (slice "page" "term")
$current.Kind) }}
{{ range (split .URL "/") }}
{{ if eq "blog" . }}
{{ $active = "active" }}
{{ end }}
{{ end }}
{{ end }}
{{ if .HasChildren }}
{{ $hasSections := (hasPrefix (index .Children 0).Identifier "section.") }}
-
{{ .Name }}
{{ if $hasSections }}
{{ else }}
{{ end }}
{{ else }}
-
{{ .Name }}
{{ end }}
{{ end }}