From ebdaf0fd4ac96fa25ea130726f5ed5d8924e49fb Mon Sep 17 00:00:00 2001 From: "Jason A. Dour" <10261648+jason-dour@users.noreply.github.com> Date: Sat, 16 Nov 2024 17:44:16 -0500 Subject: [PATCH] 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. --- layouts/partials/navbar.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html index 3a6bcbb..a3d60c1 100644 --- a/layouts/partials/navbar.html +++ b/layouts/partials/navbar.html @@ -31,6 +31,8 @@ {{- range .Site.Menus.main -}} {{- if eq .Params.type "search" -}} {{- partial "search.html" (dict "params" .Params) -}} + {{- else if eq .Params.type "theme-toggle" -}} + {{- partial "theme-toggle.html" (dict "hideLabel" (.Params.hideLabel | default true)) -}} {{- else -}} {{- $link := .URL -}} {{- $external := strings.HasPrefix $link "http" -}} @@ -67,4 +69,4 @@ {{- partial "utils/icon.html" (dict "name" "hamburger-menu" "attributes" "height=24") -}} - + \ No newline at end of file