Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

index.html 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. {{ define "main" }}
  2. <article class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy mid-gray">
  3. {{ .Content }}
  4. </article>
  5. {{/* Define a section to pull recent posts from. For Hugo 0.20 this will default to the section with the most number of pages. */}}
  6. {{ $mainSections := .Site.Params.mainSections | default (slice "post") }}
  7. {{/* Create a variable with that section to use in multiple places. */}}
  8. {{ $section := where .Site.RegularPages "Section" "in" $mainSections }}
  9. {{/* Check to see if the section is defined for ranging through it */}}
  10. {{ $section_count := len $section }}
  11. {{ if ge $section_count 1 }}
  12. {{/* Derive the section name */}}
  13. {{ $section_name := index (.Site.Params.mainSections) 0 }}
  14. <div class="pa3 pa4-ns w-100 w-70-ns center">
  15. {{/* Use $section_name to get the section title. Use "with" to only show it if it exists */}}
  16. {{ with .Site.GetPage "section" $section_name }}
  17. <h1 class="flex-none">
  18. Recent {{ .Title }}
  19. </h1>
  20. {{ end }}
  21. <section class="w-100 mw8">
  22. {{/* Range through the first three items of the section */}}
  23. {{ range (first 3 $section) }}
  24. <div class="relative w-100 mb4">
  25. {{ partial "summary-with-image.html" . }}
  26. </div>
  27. {{ end }}
  28. </section>
  29. {{ if ge $section_count 4 }}
  30. <section class="w-100">
  31. <h1 class="f3">More</h1>
  32. {{/* Now, range through the next four after the initial 3 items. Nest the requirements, "after" then "first" on the outside */}}
  33. {{ range (first 4 (after 3 $section)) }}
  34. <h2 class="f5 fw4 mb4 dib mr3">
  35. <a href="{{ .URL }}" class="link black dim">
  36. {{ .Title }}
  37. </a>
  38. </h2>
  39. {{ end }}
  40. {{/* As above, Use $section_name to get the section title, and URL. Use "with" to only show it if it exists */}}
  41. {{ with .Site.GetPage "section" $section_name }}
  42. <a href="{{ .URL }}" class="link db f6 pa2 br3 bg-mid-gray white dim w4 tc">All {{.Title }}</a>
  43. {{ end }}
  44. </section>
  45. {{ end }}
  46. </div>
  47. {{ end }}
  48. {{ end }}