From 845ef3d41f070ef530f68b21f7f30d7ad3ca522a Mon Sep 17 00:00:00 2001 From: Mark Dumay <61946753+markdumay@users.noreply.github.com> Date: Thu, 19 Feb 2026 16:08:23 +0100 Subject: [PATCH] feat: add helper to retrieve theme icon Actively checks if site.Params.icons if of the correct type. Provides an alias or default when no site icon is found. --- layouts/_partials/utilities/GetThemeIcon.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 layouts/_partials/utilities/GetThemeIcon.html diff --git a/layouts/_partials/utilities/GetThemeIcon.html b/layouts/_partials/utilities/GetThemeIcon.html new file mode 100644 index 0000000..4a9f373 --- /dev/null +++ b/layouts/_partials/utilities/GetThemeIcon.html @@ -0,0 +1,12 @@ +{{- $id := .id -}} +{{- $alias := .alias -}} +{{- $default := .default -}} +{{- $result := "" -}} + +{{- if reflect.IsMap site.Params.icons -}} + {{- $result = or (index site.Params.icons $id) $alias $default -}} +{{- else -}} + {{- $result = or $alias $default -}} +{{- end -}} + +{{- return $result -}} \ No newline at end of file