website/layouts/partials/section.html
2020-08-16 21:52:55 +08:00

30 lines
1.0 KiB
HTML

{{ $sections := .Sections.ByWeight }}
<ul class="common-flex-layout">
{{ range $sections }}
<li>
<h2>
<span><img src="{{ .Params.icon }}" alt="{{ .LinkTitle }}"></span>
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
</h2>
{{ $page_list := where (union .Pages .Sections).ByWeight ".Params._build.render" "!=" false }}
{{ $length := len $page_list}}
<ul>
{{ range first 5 $page_list }}
<li>
{{ if .IsPage }}
<a href="{{ .RelPermalink }}" title="{{ .LinkTitle }}">{{ .LinkTitle }}</a>
{{ else }}
{{ partial "firstPageInSection" (dict "section" . "firstSection" .) }}
{{ end }}
</li>
{{ end }}
{{ if gt $length 5 }}
<li><a href="{{ .RelPermalink }}">{{ i18n "Overview" }}</a></li>
{{ end }}
</ul>
</li>
{{ end }}
{{ range $sections }}
<li style="height: 0;"></li>
{{ end }}
</ul>