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>
|
<li>
|
||||||
<a
|
<a
|
||||||
href='{{ .URL }}'
|
href='{{ .URL }}'
|
||||||
{{ if eq (default true .Params.newTab) true }}target="_blank"{{ end }}
|
{{ if .Params.newTab }}target="_blank"{{ end }}
|
||||||
{{ with .Name }}title="{{ . }}"{{ end }}
|
{{ with .Name }}title="{{ . }}"{{ end }}
|
||||||
rel="me"
|
rel="me"
|
||||||
>
|
>
|
||||||
@@ -53,13 +53,9 @@
|
|||||||
{{ $currentPage := . }}
|
{{ $currentPage := . }}
|
||||||
{{ range .Site.Menus.main }}
|
{{ range .Site.Menus.main }}
|
||||||
{{ $active := or (eq $currentPage.RelPermalink .URL) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}
|
{{ $active := or (eq $currentPage.RelPermalink .URL) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}
|
||||||
<li {{ if $active }} class='current' {{ end }}>
|
<li {{ if $active }} class='current'{{ end }}>
|
||||||
<a href='{{ .URL }}' {{ if eq .Params.newTab true }}target="_blank"{{ end }}>
|
<a href='{{ .URL }}' {{ if .Params.newTab }}target="_blank"{{ end }}>
|
||||||
{{ $icon := default .Pre .Params.Icon }}
|
{{ with .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 }}
|
|
||||||
{{ partial "helper/icon" . }}
|
{{ partial "helper/icon" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<span>{{- .Name -}}</span>
|
<span>{{- .Name -}}</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user