list_bak.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. {{ define "title" }}
  2. {{ if eq .Data.Singular "tag" }}Tag → {{ .Data.Term }}
  3. {{ else if eq .Data.Singular "category" }}Category → {{ .Data.Term }}
  4. {{ else }}
  5. {{ $currentPage := . }}
  6. {{ range .Site.Menus.main }}
  7. {{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}
  8. {{ .Name }}
  9. {{ end }}
  10. {{ end }}
  11. {{ end }}
  12. {{ if isset .Site.Params "seotitle" }} | {{ .Site.Params.seotitle }}{{ else }} | {{ .Site.Title }}{{ end }}
  13. {{ end }}
  14. {{ define "main" }}
  15. <main id="content" role="main" class="main commerce-landing">
  16. <section class="main entry-list commerce-hero-content-wrapper center overflow-hidden">
  17. <!-- <section class="main entry-list"> -->
  18. <header class="list-header">
  19. {{ $currentPage := . }}
  20. {{ range .Site.Menus.main }}
  21. {{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}
  22. <h2 class="list-label">{{ .Name }} Posts</h2>
  23. {{ end }}
  24. {{ end }}
  25. </header>
  26. {{.Content}}
  27. {{ $paginator := .Paginate (where .Pages "Type" "post") (index .Site.Params "paginate" | default 10) }}
  28. {{ if ne $paginator.TotalPages 0 }}
  29. {{ range $paginator.Pages.ByDate.Reverse }}
  30. {{ .Render "summary" }}
  31. {{ end }}
  32. {{ else }}
  33. <p>There's nothing here.<br>Create an interesting post with the command:</p>
  34. <p><code>$ hugo new post/hello-world.md</code></p>
  35. {{ end }}
  36. {{ if gt $paginator.TotalPages 1 }}
  37. <nav class="pagination">
  38. {{ if $paginator.HasPrev }}
  39. <a class="pagination-btn" href="{{ $paginator.Prev.URL }}">← Newer Posts</a>
  40. {{ end }}
  41. {{ if $paginator.HasNext }}
  42. <a class="pagination-btn pagination-next" href="{{ $paginator.Next.URL }}">Older Posts →</a>
  43. {{ end }}
  44. </nav>
  45. {{ end }}
  46. </section>
  47. </main>
  48. {{ end }}