list.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. {{ define "main" }}
  2. {{ $truncate := default true .Site.Params.truncate }}
  3. <div class="container my-5 flex-grow-1">
  4. <div class="row justify-content-evenly">
  5. <div class="col-12 col-lg-3">
  6. {{ partial "focus.html" . }}
  7. </div>
  8. <div class="col-12 col-lg-6">
  9. {{ partial "news-main.html" . }}
  10. </div>
  11. <div class="col-12 col-lg-3 mt-5 pt-5 mt-lg-0 pt-lg-0">
  12. {{ partial "news-featured.html" . }}
  13. </div>
  14. </div>
  15. {{ partial "news-tab.html" . }}
  16. <div class="row mt-5 pt-5" id="news-block">
  17. <div class="col-12 col-lg-9">
  18. <h3 class="post-block-title">
  19. <span>更多新聞</span>
  20. </h3>
  21. <div class="row news-all">
  22. {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }}
  23. {{ range $index, $element := $paginator.Pages }}
  24. {{ if (eq $index 0) }}
  25. <div class="col-12">
  26. <article>
  27. <a href="{{ .Permalink }}">
  28. <img class="img-fluid first-img" src="{{ .Params.image | relURL }}" alt="" />
  29. </a>
  30. <section class="news-info">
  31. {{ range (.GetTerms "categories") }}
  32. <a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
  33. {{ end }}
  34. <small>{{ .Date | time.Format ":date_long" }}</small>
  35. </section>
  36. <h2 class="post-title">
  37. <a href="{{ .Params.url }}">{{ .Params.title }}</a>
  38. </h2>
  39. <p class="post-depiction">
  40. <a href="{{ .Permalink }}">{{ .Summary }}</a>
  41. </p>
  42. <hr>
  43. </article>
  44. </div>
  45. {{ else }}
  46. <div class="col-12">
  47. <div class="row align-items-center">
  48. <div class="col-12 col-sm-6">
  49. <a href="{{ .Permalink }}">
  50. <img class="img-fluid" src="{{ .Params.image | relURL }}" alt="" />
  51. </a>
  52. </div>
  53. <div class="col-12 col-sm-6">
  54. <article>
  55. <section class="news-info">
  56. {{ range (.GetTerms "categories") }}
  57. <a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
  58. {{ end }}
  59. <small>{{ .Date | time.Format ":date_long" }}</small>
  60. </section>
  61. <h2 class="post-title">
  62. <a href="{{ .Params.url }}">{{ .Params.title }}</a>
  63. </h2>
  64. </article>
  65. </div>
  66. <span class="line">
  67. <hr>
  68. </span>
  69. </div>
  70. </div>
  71. {{ end }}
  72. {{ end }}
  73. </div>
  74. {{ partial "paginator" . }}
  75. </div>
  76. <div class="col-12 col-lg-3">
  77. {{ partial "news-featured.html" . }}
  78. </div>
  79. </div>
  80. </div>
  81. {{ if .Content }}
  82. <header>
  83. <h1 class="blog-post-title">
  84. <a class="text-dark text-decoration-none" href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
  85. </h1>
  86. <hr>
  87. </header>
  88. <section class="blog-post">
  89. {{ .Content }}
  90. </section>
  91. {{ end }}
  92. <!-- {{ $paginator := .Paginate .Pages }}
  93. {{ range $paginator.Pages }}
  94. {{ if $truncate }}
  95. {{ .Render "summary" }}
  96. {{ else }}
  97. {{ .Render "content" }}
  98. {{ end }}
  99. {{ end }}
  100. {{ partial "paginator" . }} -->
  101. {{ end }}