index.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {{ define "loadshortcodes" }}
  2. {{/*
  3. Here Hugo is forced to cycle through all the items that will appear on
  4. the page, effectively pre-rendering all their shortcodes. Afterwards,
  5. when a shortcode contains a "css" or a "js" entry in their local
  6. .Scratch variable, the content of this entry is merged to the content
  7. of the corresponding entry in the global .Scratch variable. These
  8. resources are then loaded in the head of the page from the global
  9. .Scratch variable (see layout baseof.html).
  10. */}}
  11. {{ $paginator := where site.RegularPages "Type" "in" site.Params.mainSections | .Paginate }}
  12. {{ range $paginator.Pages }}
  13. {{ with .Content }}{{ end }}
  14. {{ with .Scratch.Get "css" }}
  15. {{ . | merge ($.Scratch.Get "css") | $.Scratch.Set "css" }}
  16. {{ end }}
  17. {{ with .Scratch.Get "js" }}
  18. {{ . | merge ($.Scratch.Get "js") | $.Scratch.Set "js" }}
  19. {{ end }}
  20. {{ end }}
  21. {{ .Scratch.Set "paginator" $paginator }}
  22. {{ end }}
  23. {{ define "main" }}
  24. {{ $paginator := .Scratch.Get "paginator" }}
  25. {{ range $paginator.Pages }}
  26. <article>
  27. {{ partial "heading.html" . }}
  28. {{ if site.Params.summaries }}
  29. {{ .Summary }}
  30. {{ if .Truncated }}
  31. <p>
  32. <a class="u-clickable" href="{{ .Permalink }}">Read More…</a>
  33. </p>
  34. {{ end }}
  35. {{ else }}
  36. {{ .Content }}
  37. {{ end }}
  38. {{ partial "tags.html" . }}
  39. </article>
  40. {{ with site.Params.divider }}<div class="Divider"></div>{{ end }}
  41. {{ end }}
  42. {{ partial "pagination.html" $paginator }}
  43. {{ end }}