alphabetical sorting

This commit is contained in:
shizuka 2019-01-24 13:24:51 +01:00
parent c1e5e89506
commit e2664c70a6

View File

@ -12,7 +12,6 @@
{{ .Site.Title }} {{ .Site.Title }}
</a> </a>
{{end}} {{end}}
<form class="sidebar-header sidebar-brand" action="https://szukaj.wmi.amu.edu.pl/search/" method="GET"> <form class="sidebar-header sidebar-brand" action="https://szukaj.wmi.amu.edu.pl/search/" method="GET">
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control" name="q" placeholder="Search" aria-label="Search field, Search field, Text"/> <input type="text" class="form-control" name="q" placeholder="Search" aria-label="Search field, Search field, Text"/>
@ -21,26 +20,27 @@
<span class="glyphicon glyphicon-search"></span> <span class="glyphicon glyphicon-search"></span>
</button> </button>
</span> </span>
</div> </div>
</div> </div>
{{ if eq .Lang "en"}}
<div class="sidebar-menu"> <div class="sidebar-menu">
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
{{ if .HasChildren }} {{ if .HasChildren }}
<li class="item {{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a> <li class="item {{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a>
{{ if or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) }} {{ if or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) }}
<ul> <ul>
{{ range .Children }} {{ range sort .Children ".Name" }}
<li class="sub-item{{ if $currentPage.IsMenuCurrent "main" . }} active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a> <li class="sub-item{{ if $currentPage.IsMenuCurrent "main" . }} active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a>
{{ if or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) }} {{ if or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) }}
<ul> <ul>
{{ range .Children }} {{ range sort .Children ".Name" }}
<li class="subsub-item{{ if $currentPage.IsMenuCurrent "main" . }} active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a> <li class="subsub-item{{ if $currentPage.IsMenuCurrent "main" . }} active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a>
{{ if or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) }} {{ if or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) }}
<ul> <ul>
{{ range .Children }} {{ range sort .Children ".Name" }}
<li class="subsubsub-item{{ if $currentPage.IsMenuCurrent "main" . }} active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a></li> <li class="subsubsub-item{{ if $currentPage.IsMenuCurrent "main" . }} active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }} {{ end }}
</ul> </ul>
{{ end }} {{ end }}
@ -57,3 +57,38 @@
{{ end }} {{ end }}
</div> </div>
</ul> </ul>
{{ else }}
<div class="sidebar-menu">
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<li class="item {{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a>
{{ if or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) }}
<ul>
{{ range sort .Children ".KeyName" }}
<li class="sub-item{{ if $currentPage.IsMenuCurrent "main" . }} active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a>
{{ if or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) }}
<ul>
{{ range sort .Children ".KeyName" }}
<li class="subsub-item{{ if $currentPage.IsMenuCurrent "main" . }} active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a>
{{ if or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) }}
<ul>
{{ range sort .Children ".KeyName" }}
<li class="subsubsub-item{{ if $currentPage.IsMenuCurrent "main" . }} active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
</ul>
{{ end }}
</li>
{{ end }}
</ul>
{{ end }}
</li>
{{ end }}
</ul>
{{ end }}
</li>
{{ end }}
{{ end }}
</div>
</ul>
{{ end }}