From d095b3b32a0efd1bfd78a72dc316935ee9c00c03 Mon Sep 17 00:00:00 2001 From: Razon Yang Date: Mon, 28 Oct 2024 12:58:22 +0800 Subject: [PATCH] fix: svg-resource not working with vendor aliases (#444) --- layouts/partials/icons/functions/svg-resource.html | 7 ++++++- layouts/partials/icons/icon.html | 3 --- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/layouts/partials/icons/functions/svg-resource.html b/layouts/partials/icons/functions/svg-resource.html index 0ee4350..d8f20a5 100644 --- a/layouts/partials/icons/functions/svg-resource.html +++ b/layouts/partials/icons/functions/svg-resource.html @@ -1,2 +1,7 @@ -{{- $path := printf "icons/%s/%s.svg" .vendor .name }} +{{- $vendor := .vendor }} +{{- $name := string .name }} +{{- with index site.Params.icons.vendors $vendor }} + {{- $vendor = .name }} +{{- end }} +{{- $path := printf "icons/%s/%s.svg" $vendor $name }} {{- return (resources.Get $path) -}} diff --git a/layouts/partials/icons/icon.html b/layouts/partials/icons/icon.html index 3f8679b..e1b198d 100644 --- a/layouts/partials/icons/icon.html +++ b/layouts/partials/icons/icon.html @@ -9,9 +9,6 @@ */}} {{- $vendor := .vendor }} {{- $name := string .name }} -{{- with index site.Params.icons.vendors $vendor }} - {{- $vendor = .name }} -{{- end }} {{- $res := dict "vendor" $vendor "name" $name }} {{- $icon := partialCached "icons/functions/svg-resource" $res $res -}} {{- if not $icon -}}