You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 

42 lines
1.5 KiB

{{ define "main" }}
<h1>{{.Title}}</h1>
<div>
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
{{.Content}}
</div>
{{ $has_categories := gt (len (first 1 (where .Pages ".Params.category" "ne" nil))) 0 }}
{{ $has_without_categories := gt (len (first 1 (where .Pages ".Params.category" "eq" nil))) 0 }}
<!-- Ranges through content/posts/*.md -->
{{ if $has_categories }}
{{ range .Pages.GroupByParam "Category" }}
<div class="pure-g">
<div class="pure-u-1">
{{ if .Key }}
<h2>{{ .Key }}</h2>
{{ end }}
{{ range .Pages }}
<div class="pure-g">
<div class="pure-u-1">
<a href="{{.Permalink}}">{{.Title}}</a>
</div>
</div>
{{ end }}
</div>
</div>
{{ end }}
{{ end }}
{{ if and $has_categories $has_without_categories }}
<div class="pure-g">
<div class="pure-u-1">
<h2>Others:</h2>
</div>
</div>
{{ end }}
{{ range where .Pages ".Params.category" "==" nil }}
<div class="pure-g">
<div class="pure-u-1">
<a href="{{.Permalink}}">{{.Date.Format "2006-01-02"}} | {{.Title}}</a>
</div>
</div>
{{ end }}
{{ end }}