mirror of
https://github.com/gethinode/hinode.git
synced 2025-10-11 12:03:10 +00:00
55 lines
1.8 KiB
HTML
55 lines
1.8 KiB
HTML
<!--
|
|
Copyright © 2024 The Hinode Team / Mark Dumay. All rights reserved.
|
|
Use of this source code is governed by The MIT License (MIT) that can be found in the LICENSE file.
|
|
Visit gethinode.com/license for more details.
|
|
-->
|
|
|
|
{{ $error := false }}
|
|
|
|
<!-- Validate arguments -->
|
|
{{ if partial "utilities/IsInvalidArgs.html" (dict "structure" "navbar" "args" .Params "group" "shortcode") }}
|
|
{{ errorf "Invalid arguments: %s" .Position -}}
|
|
{{ $error = true }}
|
|
{{ end }}
|
|
|
|
<!-- Initialize arguments -->
|
|
{{- $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 "" -}}
|
|
|
|
<!-- Main code -->
|
|
{{ 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 -}} |