refactor(menu): use .Params.icon to configure menu item icon (#400)

This commit is contained in:
Jimmy Cai
2021-10-23 09:18:44 +02:00
committed by GitHub
parent a822411a03
commit 7c59ac7713
5 changed files with 12 additions and 5 deletions
+5 -1
View File
@@ -40,8 +40,12 @@
<li {{ if $active }} class='current' {{ end }}>
<a href='{{ .URL | relLangURL }}' {{ if eq .Params.newTab true }}target="_blank"{{ end }}>
{{ $icon := default .Pre .Params.Icon }}
{{ if .Pre }}
{{ partial "helper/icon" .Pre }}
{{ warnf "Menu item [%s] is using [pre] field to set icon, please use [params.icon] instead.\nMore information: https://docs.stack.jimmycai.com/configuration/custom-menu.html" .URL }}
{{ end }}
{{ with $icon }}
{{ partial "helper/icon" . }}
{{ end }}
<span>{{- .Name -}}</span>
</a>