section-index.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. <div class="section-index">
  2. {{ $page := .Page -}}
  3. {{ $pages := (where .Site.Pages "Section" .Section).ByWeight -}}
  4. {{ $pages = (where $pages "Type" "!=" "search") }}
  5. {{ $pages = (where $pages ".Params.hide_summary" "!=" true) -}}
  6. {{ $pages = (where $pages ".Parent" "!=" nil) -}}
  7. {{ $pages = (where $pages ".Parent.File" "!=" nil) -}}
  8. {{ if $page.File -}}
  9. {{ $pages = (where $pages "Parent.File.UniqueID" "==" $page.File.UniqueID) -}}
  10. {{ end -}}
  11. {{ if or $page.Params.no_list (eq (len $pages) 0) -}}
  12. {{/* If no_list is true or we don't have subpages we don't show a list of subpages */}}
  13. {{ else if $page.Params.simple_list -}}
  14. {{/* If simple_list is true we show a bulleted list of subpages */}}
  15. <ul>
  16. {{ range $pages -}}
  17. {{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }}
  18. <li><a href="{{ $manualLink }}"{{ with .Params.manualLinkTitle }} title="{{ . }}"{{ end }}{{ with .Params.manualLinkTarget }} target="{{ . }}"{{ if eq . "_blank" }} rel="noopener"{{ end }}{{ end }}>{{- .Title -}}</a></li>
  19. {{ end -}}
  20. </ul>
  21. {{ else -}}
  22. {{/* Otherwise we show a nice formatted list of subpages with page descriptions */}}
  23. <hr class="panel-line">
  24. {{ range $pages -}}
  25. {{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) -}}
  26. <div class="entry">
  27. <h5>
  28. <a href="{{ $manualLink }}"{{ with .Params.manualLinkTitle }} title="{{ . }}"{{ end }}{{ with .Params.manualLinkTarget }} target="{{ . }}"{{ if eq . "_blank" }} rel="noopener"{{ end }}{{ end }}>{{- .Title -}}</a>
  29. </h5>
  30. <p>{{ .Description | markdownify -}}</p>
  31. </div>
  32. {{ end -}}
  33. {{ end -}}
  34. </div>