Implement theme toggle in navbar.

- Add additional logic for navbar partial.
- Uses a menu item params.type of `theme-toggle`.
- Uses additional params.hideLabel boolean to set hideLabel for the theme-toggle.html partial.
This commit is contained in:
Jason A. Dour 2024-11-16 17:44:16 -05:00
parent 86a1f3fd96
commit ebdaf0fd4a
No known key found for this signature in database
GPG Key ID: 486487B5A49FA0A9

View File

@ -31,6 +31,8 @@
{{- range .Site.Menus.main -}} {{- range .Site.Menus.main -}}
{{- if eq .Params.type "search" -}} {{- if eq .Params.type "search" -}}
{{- partial "search.html" (dict "params" .Params) -}} {{- partial "search.html" (dict "params" .Params) -}}
{{- else if eq .Params.type "theme-toggle" -}}
{{- partial "theme-toggle.html" (dict "hideLabel" (.Params.hideLabel | default true)) -}}
{{- else -}} {{- else -}}
{{- $link := .URL -}} {{- $link := .URL -}}
{{- $external := strings.HasPrefix $link "http" -}} {{- $external := strings.HasPrefix $link "http" -}}