refactor(sidebar): drop support for .Pre and remove old codes (#1271)
* refactor(sidebar): drop support for .Pre and remove old codes * Simplify
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
<li>
|
||||
<a
|
||||
href='{{ .URL }}'
|
||||
{{ if eq (default true .Params.newTab) true }}target="_blank"{{ end }}
|
||||
{{ if .Params.newTab }}target="_blank"{{ end }}
|
||||
{{ with .Name }}title="{{ . }}"{{ end }}
|
||||
rel="me"
|
||||
>
|
||||
@@ -54,12 +54,8 @@
|
||||
{{ range .Site.Menus.main }}
|
||||
{{ $active := or (eq $currentPage.RelPermalink .URL) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}
|
||||
<li {{ if $active }} class='current'{{ end }}>
|
||||
<a href='{{ .URL }}' {{ if eq .Params.newTab true }}target="_blank"{{ end }}>
|
||||
{{ $icon := default .Pre .Params.Icon }}
|
||||
{{ if .Pre }}
|
||||
{{ warnf "Menu item [%s] is using [pre] field to set icon, please use [params.icon] instead.\nMore information: https://stack.jimmycai.com/config/menu" .URL }}
|
||||
{{ end }}
|
||||
{{ with $icon }}
|
||||
<a href='{{ .URL }}' {{ if .Params.newTab }}target="_blank"{{ end }}>
|
||||
{{ with .Params.Icon }}
|
||||
{{ partial "helper/icon" . }}
|
||||
{{ end }}
|
||||
<span>{{- .Name -}}</span>
|
||||
|
||||
Reference in New Issue
Block a user