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.

41 lines
1.5 KiB

  1. {{ define "main" }}
  2. <h1>{{.Title}}</h1>
  3. <div>
  4. <!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
  5. {{.Content}}
  6. </div>
  7. {{ $has_categories := gt (len (first 1 (where .Pages ".Params.category" "ne" nil))) 0 }}
  8. {{ $has_without_categories := gt (len (first 1 (where .Pages ".Params.category" "eq" nil))) 0 }}
  9. <!-- Ranges through content/posts/*.md -->
  10. {{ if $has_categories }}
  11. {{ range .Pages.GroupByParam "Category" }}
  12. <div class="pure-g">
  13. <div class="pure-u-1">
  14. {{ if .Key }}
  15. <h2>{{ .Key }}</h2>
  16. {{ end }}
  17. {{ range .Pages }}
  18. <div class="pure-g">
  19. <div class="pure-u-1">
  20. <a href="{{.Permalink}}">{{.Title}}</a>
  21. </div>
  22. </div>
  23. {{ end }}
  24. </div>
  25. </div>
  26. {{ end }}
  27. {{ end }}
  28. {{ if and $has_categories $has_without_categories }}
  29. <div class="pure-g">
  30. <div class="pure-u-1">
  31. <h2>Others:</h2>
  32. </div>
  33. </div>
  34. {{ end }}
  35. {{ range where .Pages ".Params.category" "==" nil }}
  36. <div class="pure-g">
  37. <div class="pure-u-1">
  38. <a href="{{.Permalink}}">{{.Date.Format "2006-01-02"}} | {{.Title}}</a>
  39. </div>
  40. </div>
  41. {{ end }}
  42. {{ end }}