{{ $p := slice }} {{ range site.Taxonomies.categories }} {{ $p = $p | append .Page }} {{ end }}

### Topics

{{/* 收集所有 categories，並帶上文章數量 */}} {{ $cats := slice }} {{ range $name, $taxonomy := site.Taxonomies.categories }} {{ $cats = $cats | append (dict "name" $name "count" (len $taxonomy.Pages) "page" $taxonomy.Page ) }} {{ end }} {{/* 依照 count 由多到少排序（熱門分類優先） */}} {{ $cats = sort $cats "count" "desc" }}
{{ range $index, $element := first 6 $p }}
{{ $t := slice .LinkTitle }} {{ range $index, $element := where .Site.Pages ".Params.categories" "intersect" $t }} {{ if or (eq $index 0) (eq $index 1) }}
{{ range (.GetTerms "categories") }} {{ .LinkTitle }} {{ end }} {{ .Date | time.Format ":date_long" }}

## {{ .Params.title }}

{{ else if or (eq $index 2) (eq $index 3) (eq $index 4) (eq $index 5) }}
{{ range (.GetTerms "categories") }} {{ .LinkTitle }} {{ end }} {{ .Date | time.Format ":date_long" }}

## {{ .Params.title }}

{{ .Summary }}

{{ end }} {{ end }}
{{ end }}