posts.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. {{ $ := .root }}
  2. {{ $page := .page }}
  3. {{ $query := where (where $.Site.RegularPages "Type" "post") ".Params.notonhomepage" nil }}
  4. {{ $archive_page := $.Site.GetPage "section" "post" }}
  5. {{/* Check if a filter should be applied. */}}
  6. {{ if $page.Params.filter_tag }}
  7. {{ $archive_page = $.Site.GetPage (printf "tags/%s" $page.Params.filter_tag) }}
  8. {{ $query = $query | intersect $archive_page.Pages }}
  9. {{ else if $page.Params.filter_category }}
  10. {{ $archive_page = $.Site.GetPage (printf "categories/%s" $page.Params.filter_category) }}
  11. {{ $query = $query | intersect $archive_page.Pages }}
  12. {{ end }}
  13. {{ $count := len ($query) }}
  14. <!-- Blog Posts widget -->
  15. <div class="row">
  16. <div class="col-12 col-lg-4 section-heading">
  17. <h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
  18. {{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
  19. {{ if gt $count $page.Params.count }}
  20. <p class="view-all">
  21. <a href="{{ $archive_page.RelPermalink }}">
  22. {{ i18n "more_posts" | markdownify }}
  23. <i class="fas fa-angle-double-right"></i>
  24. </a>
  25. </p>
  26. {{ end }}
  27. </div>
  28. <div class="col-12 col-lg-8">
  29. {{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
  30. {{ range $post := first $page.Params.count $query }}
  31. {{ if eq $page.Params.list_format 0 }}
  32. {{ partial "post_li_simple" . }}
  33. {{ else if eq $page.Params.list_format 1 }}
  34. {{ partial "post_li_detailed" . }}
  35. {{ else }}
  36. {{ partial "post_li_stream" . }}
  37. {{ end }}
  38. {{end}}
  39. </div>
  40. </div>