{{ $error := false }} {{ if partial "utilities/IsInvalidArgs.html" (dict "structure" "navbar" "args" .Params "group" "shortcode") }} {{ errorf "Invalid arguments: %s" .Position -}} {{ $error = true }} {{ end }} {{- $id := .Get "id" | default (printf "navbar-collapse-%d" (add .Ordinal 1)) -}} {{ $path := .Get "path" }} {{ $page := "" }} {{ if $path }}{{ $page = .Site.GetPage $path }}{{ end }} {{ if and $path (not $page) }} {{ errorf "Cannot find page '%s': %s" $path .Position -}} {{ $error = true -}} {{ end }} {{ $menus := .Get "menus" | default "main" -}} {{ $size := .Get "size" | default "md" -}} {{ $style := .Get "style" | default "light" -}} {{ $inverseStyle := "light" -}} {{ if eq $style "light" }}{{ $inverseStyle = "dark" }}{{ end -}} {{ $color := .Get "color" | default "" -}} {{ $searchParam := true -}} {{ with .Get "search" }}{{ $searchParam = partial "utilities/CastBool.html" . }}{{ end -}} {{ $modeParam := true -}} {{ with .Get "mode" }}{{ $modeParam = partial "utilities/CastBool.html" . }}{{ end -}} {{ $logo := .Get "logo" | default "" -}} {{ $title := .Get "title" | default "" -}} {{- $class := .Get "class" | default "" -}} {{ if not $error -}} {{- partial "assets/navbar.html" (dict "id" $id "page" $page "size" $size "style" $style "color" $color "search" $searchParam "mode" $modeParam "menus" $menus "logo" $logo "title" $title "class" $class ) -}} {{ end -}}